I'm working on an interactive which has jQuery to adjust the positioning of certain animations based on screensize. The issue is that this doesn't update as the screen is resized, unlike Media Queries on CSS.
I've tried this method:
var screenSize = viewport()['width'];
$(window).resize(function() {
if (screenSize >= 730 && screenSize <= 739) {
// new animation positions
} else if (screenSize >= 740 && screenSize <= 749) {
// new animation positions
} else {
// new animation positions
}
});
Any idea why this wouldn't work? I can resize the window and refresh to find the animations in the new positions, but not when it's resized without the refresh.
Thanks.