How to change Malihu Custom Scrollbar snapAmoun on resize?

139 Views Asked by At
var slideAmount = $(window).width() > 1200 ? 300 : 10;
    $(".selector").mCustomScrollbar({
        axis:"x",
        keyboard:{ enable: false },
        snapAmount: slideAmount,
    });

How i can update snapAmount in this case? For an example i want it to be 300px if window's width is over 1200px and 10px, if its under while resizing. I've tried with onUpdate callback, but it doesnt work and i've read the documentation and tried almost everything, but couldn't find a solution. Please help.

1

There are 1 best solutions below

0
Vladimir-Manov On

So i found the solution in the comments on their website posted 5 years ago.

You need to add this:

$(".selector").data("mCS").opt.snapAmount=slideAmount;

You put that on a callback of your choice and you update the setting you choose, in this example snapAmount.