1

I'm using jQuery mCustomScrollbar on my website.

I'm using 2 functions, using the same onClick action:

$('body').on('click', '.infos_open', function () {

First I want my custom content to scroll back:

$(".mCustomScrollbar").mCustomScrollbar("scrollTo",0);

And once it's done, another function (as an example):

$('.infos_fixed').removeClass('fixed');

But I can't figure out how to use a callback to do this.

here is what I've tried:

$('body').on('click', '.infos_open', function () {

     $(".mCustomScrollbar").mCustomScrollbar("scrollTo",0, function(){ 

          $('.infos_fixed').removeClass('fixed');

     });
});

And here is another solution I tried, which is not working:

$('body').on('click', '.infos_open', function () {

    $(".mCustomScrollbar").mCustomScrollbar("scrollTo",0, {
        scrollInertia: 3000,
        callbacks: {
            onScroll: function(){

                $('.infos_fixed').removeClass('fixed');

            }
        }
    });

});

Can't find more information about this, I need to keep the exact syntax "$('body').on('click', '.infos_open', function () {"

Can anybody help with this?

Asef Hossini
  • 655
  • 8
  • 11
mmdwc
  • 1,095
  • 6
  • 27
  • 53
  • Have you looked at http://manos.malihu.gr/jquery-custom-content-scroller/#callbacks-section – artm Dec 14 '15 at 23:34
  • @artm, yes I had a look, please take a look at my edited question, the second option... which is not working – mmdwc Dec 14 '15 at 23:40

0 Answers0