malihu / malihu-custom-scrollbar-plugin

Highly customizable custom scrollbar jQuery plugin, featuring vertical/horizontal scrollbars, scrolling momentum, mouse-wheel, keyboard and touch support etc.
http://manos.malihu.gr/jquery-custom-content-scroller
MIT License
4.11k stars 1.51k forks source link

Is there a way to change the default value of the onCreate callback function? #665

Closed jiniC closed 3 years ago

jiniC commented 3 years ago

because of this issue : https://github.com/malihu/malihu-custom-scrollbar-plugin/issues/663 I would like to put this bugfix function as the defaults property of onCreate. Due to the circumstances of the project, I can't call a function for fixing bugs with onCreate callbacks everywhere I am creating mCustomScrollbar. onCreate callbacks everywhere I am creating mCustomScrollbar. Is there a way to make this bugfix function default to the onCreate function, other than by modifying the library script itself?

I tried this method,

$.mCustomScrollbar.defaults.callbacks.onCreate = function () { mCustomScrollbarBugFix(this); };

but it didn't work because the onCreate function was replaced after the mCustomScrollbar was created and already tried to call the onCreate function. Also, this method was not possible because I had to go through all the mCustomScrollbars and pass the appropriate arguments.

Is there any other way?

jiniC commented 3 years ago

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