richardscarrott / jquery-ui-carousel

jQuery RS Carousel is a responsive and touch-enabled carousel written on top of jQuery and the jQuery UI Widget Factory providing a full and familiar API in less than 2.6kB minified and gzipped.
http://richardscarrott.github.io/jquery-ui-carousel/
192 stars 56 forks source link

Carousel function name too general, causes conflicts in Bootstrap #79

Closed mokanfar closed 9 years ago

mokanfar commented 9 years ago

Thank you for your wonderful script and continued support! Bootstrap and a lot of other themes/frameworks use namespace "carousel" across class elements and vendor scripts. This as a result gets your script applied to undesired elements even though you have a unique class name itself ( $('.rs-carouselo').carousel(); ). I did a simple hack by renaming the carousel function/styling to make it work though. Is there a cleaner way to do this?

richardscarrott commented 9 years ago

I think you can change it's name by extending it, e.g.

    $.widget('rs.foo', $.rs.carousel, {});
    $('.rs-carousel').foo();

Just make sure that is run before Bootstrap (or whatever carousel script is taking the $.fn.carousel namespace) is run.