- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to Scroll to the top of the page using JavaScript/ jQuery?
Example
<html> <body> <script> $("a").click(function() { $("html, body").animate({ scrollTop: 0 }, "slow"); return false; }); </script> <h3>TOP OF PAGE</h3> <br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text.<br> This is demo text. <br> <h3>BOTTOM OF PAGE</h3> <a href="#">Scroll up</a> </body> </html>
- Related Articles
- How to find horizontal Scroll Position using jQuery?
- How to scroll down the page till page end in the Selenium WebDriver?
- How to scroll to element in horizontal div using jQuery?
- How to scroll the Page up or down in Selenium WebDriver using java?
- How to make a page redirect using jQuery?
- How to loop through all the iframes elements of a page using jQuery?
- How to scroll up/down a page using Actions class in Selenium?
- How to scroll a Web Page using coordinates of a WebElement in Selenium WebDriver?
- How to find left position of element in horizontal scroll container using jQuery?
- How to click anywhere on the page except one element using jQuery?
- How to load a page in div using jQuery?
- How to Scroll top in RecyclerView with LinearLayoutManager
- How to set scroll left position in jQuery?
- How to draw on scroll using JavaScript and SVG?
- How to use multiple versions of jQuery on the same page?

Advertisements