Is it possible to have the carousel-indicators list outside the Carousel Div? And at the bottom, I'm asking if it's possible to search the entire page for specific elements with a class tied to them.
I'm imagining something like this:
<div id="presentation" class="tab-pane active">
<div id="presentationCarousel" class="carousel slide">
<div class="carousel-inner">
<div class="item active"><img src="...1.jpg" alt="" /></div>
<div class="item active"><img src="...2.jpg" alt="" /></div>
<div class="item active"><img src="...3.jpg" alt="" /></div>
</div>
<a class="carousel-control left" href="#presentationCarousel" data-slide="prev">‹</a>
<a class="carousel-control right" href="#presentationCarousel" data-slide="next">›</a>
</div>
</div>
<div id="chapterList">
<ol class="carousel-indicators">
<li data-target="#presentationCarousel" data-slide-to="0" class="active"></li>
<li data-target="#presentationCarousel" data-slide-to="1"></li>
<li data-target="#presentationCarousel" data-slide-to="3"></li>
</ol>
</div>
Is it possible?
Just to add, I checked out the bootstrap JS source and found this line:
this.$indicators = this.$element.find('.carousel-indicators')
It just populates the list indicators. I imagine the this reference is for the presentation div element.
JAVASCRIPT QUESTION
Is it possible to search the entire page for elements by removing the this reference?
this.$indicators = $element.find('.carousel-indicators')
Any piece of advise would be highly appreciated. Thanks!
You just need to override two properties ( width and height ) and add a new one, border-radius , to . carousel-indicators li . Make width and height values equal eg: 10px each and give a border-radius of 100% .
Following are the steps to create a Bootstrap carousel:Apply CSS to resize the . carousel Bootstrap card body by using the code segment below. In this step, the sliding images are defined in the division tag as under. Last step is to add controls to slide images using the carousel-control class as below.
Carousels don't automatically normalize slide dimensions. As such, you may need to use additional utilities or custom styles to appropriately size content. While carousels support previous/next controls and indicators, they're not explicitly required. Add and customize as you see fit.
Bit late to the party but you could try adding a script like this...
$('#myCarousel').on('slide.bs.carousel', function () {
$holder = $( "ol li.active" );
$holder.next( "li" ).addClass("active");
if($holder.is(':last-child'))
{
$holder.removeClass("active");
$("ol li:first").addClass("active");
}
$holder.removeClass("active");
})
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With