Throttling mouse scroll

robnichols's Avatar

robnichols

01 Dec, 2016 11:35 PM

Hi Dimitry,

I have been exploring throttling mouse scrolling using the Lodash library.

Do you know why this isn't working?

-

$(document).on('mousewheel', _.throttle(function(){
scrollA();
}, 4000));

function scrollA(){ if(!slider.hasTouch) {
slider.slider.bind('mousewheel',function(event, delta){
if ( delta < 0 ) { slider.next(); } else if ( delta > 0 ) { slider.prev(); }
});
}
};

-

Thanks for your amazing support so far!

Rob

  1. Support Staff 1 Posted by Dmitry Semenov on 02 Dec, 2016 07:36 AM

    Dmitry Semenov's Avatar

    Hello,

    Not quite understand why you're binding the wheel event second time in its handler (slider.slider.bind('mousewheel',function(event, delta)).

  2. 2 Posted by robnichols on 02 Dec, 2016 03:32 PM

    robnichols's Avatar

    I've found a touch swipe work around using the Wheel-Indicator.js plugin

    -

    var indicator = new WheelIndicator({
    elem: document.querySelector('.royalSlider'),
    callback: function(e){
    if (e.direction == 'down') {
    slider.next();
    } else if (e.direction == 'up') {
    slider.prev();
    }
    }
    });

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac