Skip to content
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

Closed
KyleNeedham opened this issue Aug 21, 2014 · 5 comments
Closed
Labels

Comments

@KyleNeedham
Copy link

Currently the carousel indicators will only toggle states if you use .carousel-indicators selector, which has very specific CSS 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' })

@juthilo juthilo added the js label Aug 21, 2014
@cvrebert
Copy link
Collaborator

Or instead of adding an option, perhaps we could have the JS use a class that has no styles associated with it.

@hnrch02
Copy link
Collaborator

hnrch02 commented Aug 21, 2014

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?

@KyleNeedham
Copy link
Author

@cvrebert That's sounds like a cleaner solution, however it would require people to update their current code.

How about:
this.$indicators = this.$element.find('[data-slide-to="0"]').parent()

I know this might be the optimal solution but it wouldn't require any implementation changes.

@cvrebert
Copy link
Collaborator

@hnrch02 It's just my personal suggestion, but yes, it'd be for v4.

@mdo
Copy link
Member

mdo commented Aug 23, 2014

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).

@mdo mdo closed this as completed Aug 23, 2014
@mdo mdo mentioned this issue Aug 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants