This is my complete jsfiddle code . After I add a new list item to jquery, I use the update for the new scroll list, but the new ul tag overflow list will save it.
This code is to create a dynamic list item (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 is for updating the mcustom scrollbar (line 52-61 in jsfiddle):
$("#expandYear ul").mCustomScrollbar({
advanced:{
updateOnContentResize: true,
updateOnImageLoad: true,
updateOnSelectorChange: "ul",
updateOnSelectorChange: "ul li",
}
});
$("#expandYear ul").mCustomScrollbar("update");
Custom scrollbar library I'm using: http://manos.malihu.gr/jquery-custom-content-scroller
Thank!
source
share