JQuery监听页面滚动总结

1、当前滚动的地方的窗口顶端到整个页面顶端的距离:

        var winPos = $(window).scrollTop();

2、获取指定元素的页面位置:

        $(val).offset().top;

3、对页面滚动条滚动的监听:要放在页面加载的时候

      $(window).scroll(function(event){

 

    });

4、设置滚动条到指定位置。$(window).scrollTop(offset)。

原文地址:https://www.cnblogs.com/double1/p/5965115.html