Capturing the “scroll down” event?

后端 未结 10 2076
闹比i
闹比i 2020-12-28 12:17

I\'m designing a very simple web page (HTML only), the only \"feature\" I want to implement is to do something when the user scrolls down the page, is there a way to capture

10条回答
  •  时光说笑
    2020-12-28 12:59

    u can simply use this

    window.addEvent('scroll',function(e) {
        if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) {
                // enter code here
            }
    });
    

提交回复
热议问题