Changes elements while scrolling a body - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:scrollTop

Description

Changes elements while scrolling a body

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){/*from ww  w.ja v a 2  s  .c  o m*/
$(document).scroll( function() {
    var top = $(this).scrollTop();
    if(top > 147){
        console.log("hey!");
    }
});
    });

      </script> 
   </head> 
   <body> 
      <div style="height: 5000px;"></div>  
   </body>
</html>

Related Tutorials