0

I want to build a Tumblr-like slider (http://www.tumblr.com/), that when the browser detects a scroll attempt it does something, in my case it'll run a function.

I can use $(window).scroll(function(){ /* ... */ });, but it won't work normally (it will be too fast). How can I do that it allows one scroll at a time and then stop it for 2 seconds to let it finish the animation?

Thanks.

1 Answers1

0

You can apply your animations after some timeout.

var t = 0;

$(window).scroll(function(){
    if(timer==0){timer=1;setTimeout(yourFunc,2000);}
});

function yourFunc(){
    //your animations there
    timer=0;
}
nicael
  • 18,550
  • 13
  • 57
  • 90