Skip to content

Relay information to the service worker on install

I have a PWA with multiple different languages and would like to cache only language specific files on install. I can’t find out a way to communicate the language to the service worker during install. Ideas on how I could do it? My js code to initiate the service worker: My code in the service-worker.js…

jQuery get the children distance from parent div

I have this HTML: Based on this class sh-sidebar-content I need to get the distance of each li element. I can get the height of sh-sidebar-content class using It shows me the height value based on the window height. For eg: 735. So, Now, I need to get the distance from this value of the li element. Answer You…

animate when changing an property from JavaScript css

If I try this code I just wrote: the animation don’t work and it directly switch from the first color to the other. (Normally I retrieve the color from an API) I would want to do a transition between the 2 values Answer I found out that linear-gradient transition / animation doesn’t work. To fix t…

How do I group data that is nested in an array?

I have a array of objects and then inside each of the object I have another array, I want to group the data inside the object array according to their category name. I tried doing it with a reduce function but it is basically giving me the same data(it is not even transformed), It’s like it is not even …