[英]javascript scroll back to the top
In jQuery: 在jQuery中:
$(document).ready(function() {
$('a[href=#top]').click(function(){
$('html, body').animate({scrollTop:0}, 'slow');
return false;
});
});
You can then make links like this: 然后,您可以进行如下链接:
<a href="#top" title="Scroll back to the top">Back to the top</a>
You can find the script here: http://www.javascriptkit.com/jkincludes/scrolltopcontrol.js 您可以在以下位置找到脚本: http : //www.javascriptkit.com/jkincludes/scrolltopcontrol.js
Although you need to use jquery for this script to work. 尽管您需要使用jquery才能使此脚本正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.