I have been using supersized jQuery for the slideshow background of my website. I am making the website responsive and using css media queries.
I would like to be a
As others mentioned, there are plenty of jQuery plugins you can use. However, if all you want to use is just plain vanilla jQuery you can also do what you want.
You can use the resize method in jquery to detect the size of the window.
$(window).resize(function() {
if ($(this).width() > 480) {
// call supersize method
}
});
Then on doc ready, just be sure to call the resize window so it will initially call or not call the method depending on your window's current size:
$(document).ready(function() {
$(window).resize();
});
PS > If you do not need this script to run every time the window resizes, but rather only when it reaches below 480 pixels, slight modifications can be made to unbind the resize method after your script needs to be disabled or enabled.