寫在開始的話
查遍的文獻,沒有找到js或者jquery定義好的方法可用,最后迫不得已自己寫了個方法。(如果哪位同學知道有其他方法,歡迎討論)
代碼
var count_index = 0;
$(window).scroll(
function(e) {
if(count_index == 0) {
var timeIntervalFunction = setInterval(function() {
count_index--;
if(count_index <= 0) {
console.log("scroll end = " + count_index);
clearInterval(timeIntervalFunction);
count_index = 0;
}
}, 300);
}
count_index++;
}
);
效果
友情鏈接:
技術博客 簡書主頁