Capturing the “scroll down” event?

后端 未结 10 2216
闹比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:56

    You can't do it with just HTML, you'll need to use Javascript. I recommend using jQuery, so your solution can look like this:

    $(document).ready(function() {
        $(window).scroll(function() {
          // do whatever you need here.
        });
    });
    

    If you don't want or are unable to use jQuery, you can use the onscroll solution posted by Anthony.

提交回复
热议问题