R. Baauw R. Baauw - 10 months ago 57
jQuery Question

Keep updating variable in Javascript

I'm trying to make divs change depending on the width and height of the page.

I would be using $(window).height() / .width() and do some calculations with the results of that in a function.

This works once I load the page, but I want it to keep updating so the size of divs change once the size of the page is changed.

I do still have doubts about this method though, and I'm open to suggestions on other ways to make this as responsive as possible.

Could you please help me out?

Thanks in advance!

Answer Source

You can achieve this simply by using css @media queries. E.g. @media (min-width: 1100px), You can mention all your required styling for the div in this media.