一、當前滾動的地方的窗口頂端到整個頁面頂端的距離:spa
var winPos = $(window).scrollTop();orm
二、獲取指定元素的頁面位置:it
$(val).offset().top;io
三、對頁面滾動條滾動的監聽:要放在頁面加載的時候event
$(window).scroll(function(event){function
});scroll
四、設置滾動條到指定位置。$(window).scrollTop(offset)。top