[frontend] Add disposal logic to the niceScroll binding
init: function (element, valueAccessor, allBindings) {
var options = valueAccessor() || {};
if ((typeof options.enable === 'undefined' || options.enable) && $.fn.niceScroll) {
- $(element).niceScroll({
+ var niceScroll = $(element).niceScroll({
cursorcolor: "#C1C1C1",
cursorborder: "1px solid #C1C1C1",
cursoropacitymin: 0,
horizrailenabled: typeof options.horizrailenabled !== 'undefined' ? options.horizrailenabled : true
});
$(element).addClass('nicescrollified');
+ ko.utils.domNodeDisposal.addDisposeCallback(element, niceScroll.remove);
}
}
};
