javascript - Run script if screen size is less than 1024px -


i'm running script on page make div id="homesplash" disappear when user scrolls beyond 600px follows:

 $(window).scroll(function() {      if ($(this).scrolltop()>600)      {         $('#homesplash').hide();      }     else      {       $('#homesplash').show();      }  }); 

i need figure out how run script if browser width greater 1024px. ideas?
i've tried implement code related post found here, can't work unfamiliar writing javascript.
thanks.

you can check $(window).width() , compare 1024. like:

$(window).scroll(function() {     if ( $(this).width() > 1024 ) {         $("#homesplash").toggle( $(this).scrolltop() <= 600 );     } }); 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -