"Carousel Extended"
Bootstrap 2.3.2 Snippet by Lewiscowles1986

<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div id="main_area"> <!-- Slider --> <div class="row"> <div class="span12" id="slider"> <!-- Top part of the slider --> <div class="row"> <div class="span8" id="carousel-bounding-box"> <div class="carousel slide" id="myCarousel"> <!-- Carousel items --> <div class="carousel-inner"> <!-- foreach --> <?php if(isset($images)): ?> <?php foreach($images as $n=>$img ): ?> <div class="active item" data-slide-number="<?php echo $n; ?>"> <img src="<?php echo $img; ?>"> </div> <?php endforeach; ?> <?php endif; ?> </div><!-- Carousel nav --> <a class="carousel-control left" data-slide="prev" href="#myCarousel">‹</a> <a class="carousel-control right" data-slide="next" href="#myCarousel">›</a> </div> </div> <div class="span4" id="carousel-text"></div> <div id="slide-content" style="display: none;"> <!-- foreach --> <div id="slide-content-0"> <h2>Slider One</h2> <p>Lorem Ipsum Dolor</p> <p class="sub-text">October 24 2012 - <a href="#">Read more</a></p> </div> <!-- /foreach --> <div id="slide-content-1"> <h2>Slider Two</h2> <p>Lorem Ipsum Dolor</p> <p class="sub-text">October 24 2012 - <a href="#">Read more</a></p> </div> <div id="slide-content-2"> <h2>Slider Three</h2> <p>Lorem Ipsum Dolor</p> <p class="sub-text">October 24 2012 - <a href="#">Read more</a></p> </div> <div id="slide-content-3"> <h2>Slider Four</h2> <p>Lorem Ipsum Dolor</p> <p class="sub-text">October 24 2012 - <a href="#">Read more</a></p> </div> <div id="slide-content-4"> <h2>Slider Five</h2> <p>Lorem Ipsum Dolor</p> <p class="sub-text">October 24 2012 - <a href="#">Read more</a></p> </div> <div id="slide-content-5"> <h2>Slider Six</h2> <p>Lorem Ipsum Dolor</p> <p class="sub-text">October 24 2012 - <a href="#">Read more</a></p> </div> </div> </div> </div> </div><!--/Slider--> <div class="row hidden-phone" id="slider-thumbs"> <div class="span12"> <!-- Bottom switcher of slider --> <ul class="thumbnails"> <?php if(isset($images)): ?> <?php foreach($images as $n=>$img ): ?> <li class="span2"> <a class="thumbnail" id="carousel-selector-<?php echo $n; ?></a>"> <img src="<?php echo $img; ?>"> </a> </li> <?php endforeach; ?> <?php endif; ?> </ul> </div> </div> </div> </div>
jQuery(document).ready(function($) { $('#myCarousel').carousel({ interval: 5000 }); $('#carousel-text').html($('#slide-content-0').html()); //Handles the carousel thumbnails $('[id^=carousel-selector-]').click( function(){ var id_selector = $(this).attr("id"); var id = id_selector.substr(id_selector.length -1); var id = parseInt(id); $('#myCarousel').carousel(id); }); // When the carousel slides, auto update the text $('#myCarousel').on('slid', function (e) { var id = $('.item.active').data('slide-number'); $('#carousel-text').html($('#slide-content-'+id).html()); }); });

Related: See More


Questions / Comments:

не пашет

Reznik () - 8 years ago - Reply 0