Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery removing mCsutomScrollbar from element

Using mCustomScrollbar on jQuery UI dialogs.

If I initiate mCsutomScrollbar on $(window).load as proposed on the mCsutomScrollbar instructions, it does not work because my dialogs are not visible at that point. So I have to initiate mCsutomScrollbar on the open event of the dialog.

open: function() {
    $(this).mCustomScrollbar();
    }

Which works except when I open the same dialog a second time mCustomScrollbar is initialized for a second time when it already is initialized and breaks. I can see the custom scrollbar but I cannot scroll.

So it seems I need a way to remove mCustomScrollbar on close or beforeclose event of the dialog. Not exactly sure how to do this.


1 Answers

turns out there is a built in function in mCustomScrollbar that does what I need

$('selector').mCustomScrollbar("destroy")