页面回到顶部解决方法
animate与ScrollTop结合使用
<script> $("#top ").click(function () { if ($('html').scrollTop()) { $('html').animate({scrollTop: 0}, 100);//跳转到0的位置 速度100 return false; $('body').animate({scrollTop: 0}, 100); return false }) var eContent = document.getElementById('rightNav') setTimeout(function () { $("#rightNav").show("slow"); }, 100); </script>

通过animate动画与ScrollTop方法结合,当鼠标点击之后,当前页面会以100的速度,跳转到位置为0的地方

这是自己设置的一个盒子id名为top,接入上方script中,在网页中点击这个盒子就可以实现回到顶部。
h5:

css:
浙公网安备 33010602011771号