4

This full my code at jsfiddle. After I add new list element by jquery, I use update to scrollbar update new list but new list overflow out tag ul store it.

This code to create list element dynamic (line 46-50 in jsfiddle):

    var d = new Date();
    var currentYear = d.getFullYear();
        for (var i=1990; i<=currentYear; i++) {
        $("#expandYear ul").append("<li><a href=\"#\">"+ i +"</a></li><li role=\"separator\" class=\"divider\"></li>");
    }

This code to update mcustom scrollbar (line 52-61 in jsfiddle):

   $("#expandYear ul").mCustomScrollbar({ 
      advanced:{ 
         updateOnContentResize: true,
         updateOnImageLoad: true,
         updateOnSelectorChange: "ul",
         updateOnSelectorChange: "ul li",
      } 
   });

   $("#expandYear ul").mCustomScrollbar("update");

Library custom scrollbar I use: http://manos.malihu.gr/jquery-custom-content-scroller

Thanks!

Hoang
  • 829
  • 11
  • 18

1 Answers1

1

Try removing the mCustomScrollbar class from your ul element - this is messing up the overflow CSS and the plugin will add it for you after initialisation anyway.

83N
  • 286
  • 1
  • 6