我怎样才能让这个滚动条从this link回到顶部整洁的东西| ,向下滚动一点,您会在右下角的图标(顶部指针)中看到单击时滚动回顶部。谢谢
最佳答案
在 jQuery 中:
$(document).ready(function() {
$('a[href=#top]').click(function(){
$('html, body').animate({scrollTop:0}, 'slow');
return false;
});
});
然后你可以像这样建立链接:
<a href="#top" title="Scroll back to the top">Back to the top</a>
关于javascript 滚动回到顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1707136/