0

I'm working on a JS widget which uses owl carousel and loaded on random sites which may or may not have existing owl carousel loaded.

Ideally it would use an existing owl if it exists or load my own if not.

What is the best practice to test for existing owl carousel and its version? Is it possible to load a parallel version for my own widgets only?

cygri
  • 9,412
  • 1
  • 25
  • 47
Nir
  • 24,619
  • 25
  • 81
  • 117
  • 1
    [check if plugin exists](https://stackoverflow.com/questions/5339876/how-to-check-jquery-plugin-and-functions-exists) and [multiple versions of plugin on same page](https://stackoverflow.com/questions/24395344/how-can-i-load-multiple-versions-of-a-jquery-plugin-on-the-same-page) – Pete Apr 23 '19 at 14:19
  • 1
    of course, if you have multiple versions of the plugin, you need to make sure that the class names don't clash otherwise the css for one may break the css for another leaving you with 2 broken carousels (if the css changes between the versions) – Pete Apr 23 '19 at 14:24
  • 2
    Kindly anyone who knows a good solution please provide it. As for those marking it duplicate the links provided do not work with owl carousel. ie `$.fn.owlCarousel` return `undefined` while `$.ui.owlCarousel` also fails with `TypeError: Cannot read property 'owlCarousel' of undefined`. – domii Apr 11 '21 at 17:55

0 Answers0