1

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?

Ahmad hamza
  • 1,816
  • 1
  • 23
  • 46

1 Answers1

5

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