How do I get the browser scroll position in jQuery?

前端 未结 3 709
长情又很酷
长情又很酷 2020-12-24 10:24

I have a web document with scroll. I want to get the value, in pixels, of the current scroll position. When I run the below function it returns the value zero. How can I

3条回答
  •  自闭症患者
    2020-12-24 10:47

    Since it appears you are using jQuery, here is a jQuery solution.

    $(function() {
        $('#Eframe').on("mousewheel", function() {
            alert($(document).scrollTop());
        });
    });
    

    Not much to explain here. If you want, here is the jQuery documentation.

提交回复
热议问题