malihu-custom-scrollbar-plugin icon indicating copy to clipboard operation
malihu-custom-scrollbar-plugin copied to clipboard

mCustomscrollbar is not working in JQuery 3.6.0

Open Praveen-raj27 opened this issue 4 years ago • 6 comments

I have updated my JQuery to latest version (3.6.0). After updating the jquery, mCustomScrollbar is not working. I also update the mCustomScrollbar to version (3.1.5). Still it is not working. The mCustomscrollbar is works fine with JQuery 3.3.1. Can anybody helps to resolve this issue?

Praveen-raj27 avatar Apr 09 '21 10:04 Praveen-raj27

this is iso to https://github.com/malihu/malihu-custom-scrollbar-plugin/issues/651

i fix it like that :

function bugFix(scrollbar) {
	const draggerRail = $(scrollbar).find(".mCSB_draggerRail");
	const draggerContainer = $(scrollbar).find(".mCSB_draggerContainer");
	if (draggerRail.length > 0 && draggerRail.parent().hasClass("mCSB_dragger")) {
		draggerContainer.append(draggerRail);
	}
}

$(#my-element).mCustomScrollbar({
    axis: "y",
    theme: "dark",
    callbacks: {
        onInit: () => bugFix(this)
    }
});

thomasPierreATECNA avatar May 26 '21 09:05 thomasPierreATECNA

I have sent pr to solve this problem fundamentally : https://github.com/malihu/malihu-custom-scrollbar-plugin/pull/666

jiniC avatar Aug 08 '21 05:08 jiniC

You can use jquery-migrate plugin with jQuery.UNSAFE_restoreLegacyHtmlPrefilter() or restore the functionality by extending your instance of jQuery manually;

The root cause is described here in Security Fix chapter

showdev avatar Oct 25 '21 12:10 showdev

go to jquery.mCustomScrollbar.js file and find the method _pluginMarkup, there is array scrollbar that hold the html, notice that few div's are closed like <div ..... /> so you need to replace the closing tags properly like <div .....>

codeyapmak avatar Mar 15 '22 18:03 codeyapmak

Yes, in _pluginMarkup replace all " />" for ">" and in _scrollButtons replace " />" for ">" you can do this directly in minified file

fullhugo avatar May 04 '22 15:05 fullhugo

this is iso to #651

i fix it like that :

function bugFix(scrollbar) {
	const draggerRail = $(scrollbar).find(".mCSB_draggerRail");
	const draggerContainer = $(scrollbar).find(".mCSB_draggerContainer");
	if (draggerRail.length > 0 && draggerRail.parent().hasClass("mCSB_dragger")) {
		draggerContainer.append(draggerRail);
	}
}

$(#my-element).mCustomScrollbar({
    axis: "y",
    theme: "dark",
    callbacks: {
        onInit: () => bugFix(this)
    }
});

Thank you so much @thomasPierreATECNA

gethari avatar Aug 29 '22 09:08 gethari