美文网首页
jq监听滑动

jq监听滑动

作者: LearningCoding | 来源:发表于2017-06-03 18:18 被阅读100次

$(window).bind('scroll', function () {
console.log($("body").scrollTop()); // 滑动的距离
console.log($(window).height()); // 屏幕高
console.log($("body").height()); // 页面的高度
console.log($('#DivID').offset().top); // 页面的高度
});

回到顶部:$('body,html').animate({scrollTop:0},500);

相关文章

网友评论

      本文标题:jq监听滑动

      本文链接:https://www.haomeiwen.com/subject/wgcmfxtx.html