schani
schani

Reputation: 61

Bootstrap carousel slide start without "active"

i like to use the Bootstrap carousel slider. Is it possible to start the slider without the active class in the first Image? The code is set with TYPOSCRIPT and i can not set the first item to active. Is there a way with JavaScript?

Thanx for help

Christian

HTML Code

<div class="carousel slide article-slide" id="myCarousel">
    <div class="carousel-inner cont-slider">
        <div class="item">
          <img class="img-responsive" src="http://placehold.it/800x300/cccccc/ffffff">
        </div>
       <div class="item">
          <img class="img-responsive" src="http://placehold.it/800x300/999999/cccccc">
        </div>
        <div class="item">
          <img class="img-responsive" src="http://placehold.it/800x300/dddddd/333333">
        </div>              
    </div>
</div>

Upvotes: 6

Views: 11065

Answers (1)

max
max

Reputation: 8667

Yes, you can add class like this (using jQuery):

$(document).ready(function () {
  $('#myCarousel').find('.item').first().addClass('active');
});

Upvotes: 6

Related Questions