I'm trying to call a function when the mouse scroll down and one when it scroll up, but unfortunately, it seams like they are both called.
http://codepen.io/nickimola/pen/ZWjOyB?editors=1010
In the pen, I'm using an horizontal scroller to change slide on mouse scroll down (simulates next) and on mouse scroll up (simulates prev).
If you open the console, you can see that the right message is printed, but strangely, it seams that when I scroll up, also the scroll down event is fired. It is a bit strange and difficult to explain, it is clearer from the pen above.
here's the code i'm using to detect scrolling:
$(document).ready(function(){
$('html').bind('mousewheel', function(e){
if(e.originalEvent.wheelDelta / 120 > 0) {
$.fn.fullpage.moveSlideLeft();
console.log('scrolling up !');
}
else{
$.fn.fullpage.moveSlideRight();
console.log('scrolling down !');
}
});
});
and this is the plugin i'm using for the horizontal slider and the callback function: https://github.com/alvarotrigo/fullPage.js#fullpagejs