How do I scroll to the top of the page with jQuery

Smith
Smith
None
2568 Points
74 Posts

Hi,

How do I scroll to the top of the page with jQuery?

Views: 8696
Total Answered: 1
Total Marked As Answer: 1
Posted On: 02-Jun-2015 04:03

Share:   fb twitter linkedin
Answers
sam
sam
Member
378 Points
48 Posts
         

Hi Smith,

Use following jquery method:

Syntax: $(selector).scrollTop();

Examples:

Scroll to top in a div

$("button").click(function () {
$("div").scrollTop();
});

  Scroll to top window scroll

$("button").click(function () {
$(window).scrollTop();
});

 

Posted On: 03-Jun-2015 01:51
 Log In to Chat