jQuery mCustomScrollbar disappears after Ajax relo

2019-04-13 02:26发布

问题:

like here written I have a problem with jQuery mCustomScrollbar. Binding the scrollbar at the first load works fine.

$("#contenDiv").load("dummytext.php", function() {
   $("#contenDiv").mCustomScrollbar({
        theme: "light",
        alwaysShowScrollbar: 1
      });
 });

But when I reload the Divs content the mCustomScrollbar disappears, althougt I call the "update" method.

$("#loadbutton").click(function() {
    $("#contenDiv").load("dummytext.php", function() {
        $(this).mCustomScrollbar("update");
    });
});

I've also been trying to work with on() and delegate() methods but they don't recognize the jquery Ajax load() event.

Can anyone help me?