window.onscroll = function(){
getScrollTop()
}
function getScrollTop() {
var scrollPos;
if (window.pageYOffset) {
scrollPos = window.pageYOffset; }
else if (document.compatMode && document.compatMode != 'BackCompat')
{ scrollPos = document.documentElement.scrollTop; }
else if (document.body) { scrollPos = document.body.scrollTop; }
console.log('现在是:'+scrollPos);
}
鼠标滚轮监测
最新推荐文章于 2024-08-18 13:52:08 发布