Scroll to specific div on page load - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:animate

Description

Scroll to specific div on page load

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
      <script type="text/javascript">
$(document).ready(function () {
    // Handler for .ready() called.
    $('html, body').animate({
        scrollTop: $('#scroll').offset().top
    }, 'slow');//w  w w.j a v a 2s.com
});

      </script> 
   </head> 
   <body> 
      <div id="scroll"></div>  
   </body>
</html>

Related Tutorials