css 到顶部按钮w / FA - https://paulund.co.uk/how-to-create-an-animated-scroll-to-top-with-jquery
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css 到顶部按钮w / FA - https://paulund.co.uk/how-to-create-an-animated-scroll-to-top-with-jquery相关的知识,希望对你有一定的参考价值。
$(document).ready(function(){
//Check to see if the window is top if not then display button
$(window).scroll(function(){
if ($(this).scrollTop() > 100) {
$('.scrollToTop').fadeIn();
} else {
$('.scrollToTop').fadeOut();
}
});
//Click event to scroll to top
$('.scrollToTop').click(function(){
$('html, body').animate({scrollTop : 0},800);
return false;
});
});