javascript - Bootstrap carousel not sliding and not displaying text -
i'm trying use small carousel found on bootply, i'm having problems. first of carousel not slide, can see first images , slides buttons don't work, second text near photos not visible, cause javascript function displays doesn't work.
this html code:
<div class="row-fluid" style="margin-top:10px; margin-left:10px;"> <div class="span9" id="slider"> <!-- top part of slider --> <div class="row-fluid"> <div class="span2" id="carousel-bounding-box"> <div id="mycarousel" class="carousel slide"> <!-- carousel items --> <div class="carousel-inner"> <div class="active item" data-slide-number="0"><img src="http://lorempixel.com/120/100" style="border-radius:3px"></div> <div class="item" data-slide-number="1"><img src="http://lorempixel.com/120/100/technics/1"style="border-radius:3px"></div> <div class="item" data-slide-number="2"><img src="http://lorempixel.com/120/100/business/1"style="border-radius:3px"></div> <div class="item" data-slide-number="3"><img src="http://lorempixel.com/120/100/city"style="border-radius:3px"></div> <div class="item" data-slide-number="4"><img src="http://lorempixel.com/120/100/city/1"style="border-radius:3px"></div> <div class="item" data-slide-number="5"><img src="http://lorempixel.com/120/100"style="border-radius:3px"></div> </div> </div> <!-- carousel nav --> <div class="carousel-controls-mini"> <a href="#mycarousel" data-slide="prev">‹</a> <a href="#mycarousel" data-slide="next">›</a> </div> </div> <div class="span4" id="carousel-text"></div> <div style="display:none;" id="slide-content"> <div id="slide-content-0"> <h5>slide one</h5> <p>this mini slider / carousel bootstrap. blah blah, blah, blah blah. lorem dolor?</p> <small>october 13 2013 - <a href="#">read more</a></small> </div> <div id="slide-content-1"> <h5>slide two</h5> <p>mini carousel bootstrap</p> <small>october 15 2013 - <a href="#">read more</a></small> </div> <div id="slide-content-2"> <h5>slider three</h5> <p>facebook-style paged image slider</p> <small>october 19 2013 - <a href="#">read more</a></small> </div> <div id="slide-content-3"> <h5>slider four</h5> <p>lorem ipsum dolor</p> <small>october 22 2013 - <a href="#">read more</a></small> </div> <div id="slide-content-4"> <h5>slider five</h5> <p>lorem ipsum dolor</p> <small>october 25 2013 - <a href="#">read more</a></small> </div> <div id="slide-content-5"> <h5>slider six</h5> <p>lorem ipsum dolor</p> <p class="sub-text">october 24 2012 - <a href="#">read more</a></p> </div> </div> </div> </div> </div> <!--/slider-->
and javascript:
$('#mycarousel').carousel({ interval: 5000 }); $('#carousel-text').html($('#slide-content-0').html()); // when carousel slides, auto update text $('#mycarousel').on('slid', function (e) { var id = $('.item.active').data('slide-number'); $('#carousel-text').html($('#slide-content-'+id).html()); });
the javascript console returns no errors, can't understand what's problem. thank you!
your html file ain't detecting jquery code
add this:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
Comments
Post a Comment