-
-
Save ki11ua/78eac465663d0f2f528d7c3915244df4 to your computer and use it in GitHub Desktop.
Auto-generate Bootstrap Carousel Indicator HTML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Auto-generate carousel indicator html | |
var bootCarousel = $(".carousel"); | |
bootCarousel.append("<ol class='carousel-indicators'></ol>"); | |
var indicators = $(".carousel-indicators"); | |
bootCarousel.find(".carousel-inner").children(".item").each(function(index) { | |
(index === 0) ? | |
indicators.append("<li data-target='#MyCarousel' data-slide-to='" + index + "' class='active'></li>") : | |
indicators.append("<li data-target='#MyCarousel' data-slide-to='" + index + "'></li>"); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment