js-点击按钮页面滚动到顶部,底部,指定位置
时间:2018-04-27 12:42:51
收藏:0
阅读:488
之所以笔记一下这个,因为我在项目中经常用到。
$(‘.scroll_top‘).click(function(){$(‘html,body‘).animate({scrollTop: ‘0px‘}, 800);}); //页面滚动至顶部
$(‘.scroll_a‘).click(function(){$(‘html,body‘).animate({scrollTop:$(‘.a‘).offset().top}, 800);}); //页面滚动至指定的位置
$(‘.scroll_bottom‘).click(function(){$(‘html,body‘).animate({scrollTop:$(‘.bottom‘).offset().top}, 800);}); //页面滚动到底部
原文:https://www.cnblogs.com/liuqingxia/p/8961750.html
评论(0)