After clicking back on top, slide the scroll bar automatically return to the top of the way

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/qq_32281471/article/details/51567613

1, if it is to show the form of non-animated: There can be

$("html , body").scrollTop(100);

$(window).scrollTop(100);

$(document).scrollTop(100);

2, if they wish to use the JQuery Animate () properties

Tested

$ ( "Html, body") animate ({scrollTop: 100}, 1000);. Feasible

$(window).animate ({scrollTop: 100}, 1000); infeasible

$(document).animate ({scrollTop: 100}, 1000); infeasible

Guess you like

Origin blog.csdn.net/qq_32281471/article/details/51567613