How do I update JavaScript when CSS change, without reloading?

Viewed 64

When I change the width of the browser window, I want it to also update the JavaScript. This is because I have made a carousel-slider where JavaScript calculates how much transformation should occur for each sliding image. When I reload the page, the transformation is correct when passing through the images (press of a button). But once I change the width of the browser window, the JavaScript does not seem to update to the new information, and in turn, make the incorrect transformation (the previous width of the carousel-slider, before changing the width). This can be fixed by reloading the page entirely, but this interrupts the flow. I would like my carousel-slider to be responsive and work correctly in real-time when the width of the window changes.

0 Answers
Related