点击按钮返回顶部
<!-- 10置顶 -->
<div class="totop">
<img src="images/totop.png" />
</div>
<script>
$(function() {
$(window).scroll(function() {
var scroHei = $(window).scrollTop();//滚动的高度
if (scroHei > 400) {
$('.totop').fadeIn();
} else {
$('.totop').fadeOut();
}
})
/*点击返回顶部*/
$('.totop').click(function() {
$('body,html').animate({
scrollTop: 0
}, 600);
})
})
</script>
参考链接:https://www.bbsmax.com/A/MAzAk1ey59/

浙公网安备 33010602011771号