-
-
Notifications
You must be signed in to change notification settings - Fork 79k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow For Custom Indicators Selector To Be Passed To Carousel Constructor #14431
Comments
Or instead of adding an option, perhaps we could have the JS use a class that has no styles associated with it. |
As a temporary solution you could do var carousel = $('#myCarousel').data('bs.carousel')
carousel.$indicators = carousel.$element.find('.custom-indicators') @cvrebert Is that the plan for v4? |
@cvrebert That's sounds like a cleaner solution, however it would require people to update their current code. How about: I know this might be the optimal solution but it wouldn't require any implementation changes. |
@hnrch02 It's just my personal suggestion, but yes, it'd be for v4. |
Adding to the v4 list. Definitely on board with more specific classes or data attrs for JS-only behavior (saving the styles for, well, styling only). |
Currently the carousel indicators will only toggle states if you use
.carousel-indicators
selector, which has very specificCSS
making style overrides messy.Allowing for indicators option will make it easy to create custom indicators that keep in sync with the current active slide.
It could be as simple as:
this.$indicators = this.$element.find(options.indicators || '.carousel-indicators')
Then initialize like:
$('#my-carousel').carousel({ indicators: '.custom-indicators' })
The text was updated successfully, but these errors were encountered: