1
I have a javascript code ( jquery ) and it performs a function when I move the scroll of the mouse, however, it performs the function several times when I take a whole turn in the scroll. I didn’t want this to happen, wanted him to be able to run again after a while. Does anyone know how I could do this?
$(window).bind('mousewheel', function (event) {
if (event.originalEvent.wheelDelta >= 0) {
$('.flexhome').flexslider('prev');
console.log('passa_slide');
return false;
} else {
$('.flexhome').flexslider('next');
console.log('volta_slide');
return false;
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
Above it takes the Prev and next function of the flexslider, when I turn to one side it runs the Prev, and when I turn to the other it runs the next. But if you spin the ball enough, it runs the Prev or next several times, passing several slides.
That’s right!!! It worked!! Thanks Sergio!!!!
– Bernardo Kowacic
@Bernardokowacic these functions are very useful. I am glad to have helped.
– Sergio
@Sergio, yes, I’m actually doing a horizontal site, and I used the flexslider to display the pages, I just took the automatic scrolling, so I just needed the site to work when I turn the haha mouse scroll.
– Bernardo Kowacic