Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

window.addEventListener('scroll',function(e){
    console.log('scroll', e)
}, );

这么写有个问题,根元素如果高度是100%,就没有 scroll 事件了。

请问用什么事件写比较合适呢? 我的目的是监听网页滚动方向


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
479 views
Welcome To Ask or Share your Answers For Others

1 Answer

移动端滚动建议用模拟滚动,类似betterScroll这种,性能略微差点,但是能接受。原生的坑比较多。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...