Using the mousewheel plugin, I have:
$('html, body').bind("mousewheel", function(objEvent, intDelta){
if (intDelta > 0 && $currentPage != 1){
$currentPage--;
$('html, body').animate({scrollTop:$("#page"+$currentPage).offset().top}, 2000);
}
else if (intDelta < 0 && $currentPage != 4){
$currentPage++;
$('html, body').animate({scrollTop:$("#page"+$currentPage).offset().top}, 2000);
}
});
Which works fine, but whenever I scroll, it scrolls up or down the page a tick first before doing the animation. Is there any way to disable this? Thanks!
Just add a
Before the last brace.
BTW, you should use .on() instead of .bind()