Updating a variable as a parameter in a function

I have a scrollable image script that I would like to update the scroll speed on the fly using the hover function. I researched and just can't figure out how to get a variable to update inside a function without calling the function again. I don’t want this to start, I just want the speed to increase as it starts.

(function ($) {
    $(function () { //on DOM ready
        var defspeed = 1;
        $(".simply-scroll-list").simplyScroll({
            speed: defspeed,
        });
    });
})(jQuery);
$('.fast-forward').hover(function () {
    var defspeed = 5;
});

As you can see above, I do not know how to integrate these two blocks of code correctly.

+3
source share
1 answer

You cannot increase the speed on the fly in a decent way, because the speed is set only once when you initialize the simpleyScroll plugin.

, . jQuery html DOM , . , . , . :)

. , , .

0

All Articles