detect distance scrolled from top jquery

前端 未结 3 2005
别那么骄傲
别那么骄傲 2020-12-13 17:30

How can I detect the number of pixels scrolled in a browser window? I need this to dynamically adjust the height of a 100% height div...

I\'m using jQuery.

3条回答
  •  庸人自扰
    2020-12-13 18:15

    use $(document).scrollTop() :

    $(document).scroll(function() {
        console.log($(document).scrollTop());
    })
    

提交回复
热议问题