Bootstrap carousel

by johnpapa

HTML

<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap-responsive.css">
<script src="http://twitter.github.com/bootstrap/assets/js/bootstrap-transition.js"></script>
<script src="http://twitter.github.com/bootstrap/assets/js/bootstrap-carousel.js"></script>
<div id="myCarousel" class="carousel slide">
  <!-- Carousel items -->
  <div class="carousel-inner">
      <div class="item active" id="home">HOME ...  Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. </div>
      <div class="item  " id="profile">PROFILE ... Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.
      </div>
      <div class="item  " id="messages">MESSAGES ... Aliquip placeat salvia cillum iphone. </div> 
 </div>
  <!-- Carousel nav -->
</div>

<button id="viewA">view A</button>
<button id="viewB">view B</button>
<button id="viewC">view C</button>

CSS

body {margin: 20px; }

.item{ width:400px; height:300px; border: solid 1px; black}

JavaScript

var $carousel = $('.carousel');
$carousel.carousel({interval: 0})

$('#viewA').click(function(){
    $carousel.carousel(0);
});
$('#viewB').click(function(){
    $carousel.carousel(1);
});
$('#viewC').click(function(){
    $carousel.carousel(2);
});


// selecting tabs individually    
//$('#myTab a:first').tab('show'); // Select first tab
//$('#myTab a[href="#profile"]').tab('show'); // Select tab by name
//$('#myTab li:eq(2) a').tab('show'); // Select third tab (0-indexed)
//$('#myTab a:last').tab('show'); // Select last tab