I have Owl carousel setup like this
<div class="owl-carousel">
<div>0</div>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
</div>
this is the js
var owl = $('.owl-carousel');
owl.owlCarousel({
items : 1,
singleItem : true,
rewindNav : false,
dots : true,
});
owl.on('mousewheel', '.owl-stage', function (e) {
if (e.deltaY<0) {
console.log(e.deltaY);
owl.trigger('next.owl');
} else {
owl.trigger('prev.owl');
}
e.preventDefault();
});
jsFiddle here: http://jsfiddle.net/f0yph3aL/
as you can see if you scroll your mousewheel over the red square, the slides are moving like crazy. I need to have the next.owl.carousel fire only once so by mousewheel scroll it changes only +1 slide.
I have tried setTimeout inside the owl.on
, tried debounce
and bind/unbind mousewheel
. Maybe I did it wrong. Thanks for any advice.
UPDATE:
Here is unbinded mousewheel, which works great but I don't know ho to bind mousewheel back on after some timeout (setTimeout)
http://jsfiddle.net/cz122kk6/1/