jQuery - Execute scripts based on screen size
You can use $(window).width()
if($(window).width() >= 1024){
// do your stuff
}
Demo --->
http://jsfiddle.net/fh2eC/1/
If you want to check width size after windows is resized then:
$(window).resize(function() {
if( $(this).width() > width ) {
// code
}
});
You might also consider a library like https://github.com/paulirish/matchMedia.js/
if (matchMedia('only screen and (max-width: 480px)').matches) {
// smartphone/iphone... maybe run some small-screen related dom scripting?
}