是否可以使用jquery仅使页面向下/向上滚动一定的时间?

时间:2017-06-08 02:15:20

标签: javascript jquery css animation scroll

我想要完成的是让用户只能在页面上滚动最多5次(每个部分一次),我会设置一个计数器并在每次用户向下滚动时递增/递减它/分别确定他们当前在页面上的位置。

一个简单的例子:

var counter = 1;

$(document).scroll(function(){
if (counter == 1) {
//fire first function/animation
} else if (counter == 2) ( // if user is scrolling down ) {
//fire second function/animation
counter++;
} else if ((counter == 3) && ( // if user is scrolling down ) {
//fire third function/animation
counter++;
}
})

依旧......

0 个答案:

没有答案