Jquery Scrollto Example - Jquery

How to scroll the page using jquery method?

Snippet Code


  
Rate this page :
  [ 0 votes]

Jquery scrollto method is a simple way to scroll on any element. This method is used to scroll the content to the any specified coordinates. Here the code scrolls the document to horizontally at 800px.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> <script> function scrollpage() { window.scrollTo(800, 0); } </script> <style> body {width: 5000px;} </style> <p>Click the button to scroll the document window to 800 pixels horizontally.</p> <input type='button' value='Click me to scroll' onclick='scrollpage()'>

Tags


Ask Questions

Ask Question