Ahmad hamza
Ahmad hamza

Reputation: 1936

How to include carousel

How to include carousel (component of twitter bootstrap) when i've already installed the twitter bootstrap in my rails application.? i ve less file in my stylesheet and bootstrap.js.coffee in assets pipeline. i wanted to use carousel in my application. how to do that?

Upvotes: 1

Views: 3948

Answers (1)

user788581
user788581

Reputation:

As tdubs answer indicates the Twitter Bootstrap documentation is the best place to start. I find that looking at the examples page source really helps.

This is how I would implement the carousel:

home.js.coffee

$('.carousel').carousel()

view

<!-- carousel -->
<div id="myCarousel" class="carousel slide">
  <div class="carousel-inner">
    <div class="item active">
      <img src="htpp://someimagepath.com" alt="foo">
      <div class="container">
        <div class="carousel-caption">
          <h1>CAPTION FOO BAR</h1>
        </div>
      </div>
    </div>
    <div class="item">
      <img src="htpp://someimagepath.com" alt="foo">
    </div>
    <div class="item">
      <img src="htpp://someimagepath.com" alt="foo">
    </div>
    <div class="item">
      <img src="htpp://someimagepath.com" alt="foo">
    </div>
    <div class="item">
      <img src="htpp://someimagepath.com" alt="foo">
    </div>
    <div class="item">
      <img src="htpp://someimagepath.com" alt="foo">
    </div>
  </div>
</div><!-- /.carousel -->

Upvotes: 5

Related Questions