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.5k forks source link

JS error when using within iframe with jquery 3+ #480

Open tolhzar opened 7 years ago

tolhzar commented 7 years ago

Getting the following error when trying to initialize the plugin in iframe: TypeError: a is not an object Only happens when using jquery 3 and higher. Working good with 2.1.3.

malihu commented 7 years ago

This error should not be related to iframe. When using jQuery 3.x, make sure you change: $(window).load(... to: $(window).on("load"...

tolhzar commented 7 years ago

We don't have that in the project. We ended up disabling the plugin in iframe. Please find attached 2 example files. The only role of embed=1 parameter in the url is skipping the initialization of custom scrollbar.

example.zip

rroesler commented 6 years ago

If anybody cares .. I think the problem is in this line of code and similar lines elsewhere in the code

eds=o.advanced.extraDraggableSelectors ? $(!_canAccessIFrame() || top.document).add($(o.advanced.extraDraggableSelectors)) : $(!_canAccessIFrame() || top.document);

Specifically $(!_canAccessIFrame() || top.document);

When to the level window is NOT accessible, this resolves to $(true);

Previously, this return window.document (I believe) but now returns an invalid jquery object (as true is not an object .. and even if it was an object it is not a document node)