Sunday, May 12, 2024
159
rated 0 times [  165] [ 6]  / answers: 1 / hits: 86415  / 12 Years ago, wed, june 27, 2012, 12:00:00

I'm using bootstrap by Twitter's carousel (latest version) and I've got it working - except that it doesn't begin to automatically slide. It works well after you've clicked one of the navigation buttons . Not sure why it's doing this.



Here's my JS setup in the header:



    <script type=text/javascript src=<?php echo tz_JS . '/bootstrap/jquery.js'; ?>></script>

<script type=text/javascript src=<?php echo tz_JS . '/bootstrap/bootstrap-carousel.js'; ?>></script>
<script type=text/javascript src=<?php echo tz_JS . '/bootstrap/bootstrap-transition.js'; ?>></script>


And the HTML:



<div id=myCarousel class=carousel slide>
<div class=carousel-inner>

<div class=active item>
<div class=image-position-right>
<a href=#><img src=validimagelink.jpg width=920 height=550 alt=></a>
</div>
</div>


<div class=item>
<div class=image-position-right>
<a href=#><img src=validimagelink.jpg width=920 height=550 alt=></a>
</div>
</div>

</div>

<a class=left carousel-control href=#myCarousel data-slide=prev>‹</a>
<a class=right carousel-control href=#myCarousel data-slide=next>›</a>





Also just added this to no avail:



<script>
$('#myCarousel').carousel({
interval: 1200
});
</script>


After making the above change, the javascript console says:



Uncaught TypeError: Object # has no method 'carousel'
(anonymous function)
b.extend.ready jquery.min.js:29
u



Any thoughts on why this wouldn't be working?


More From » twitter-bootstrap

 Answers
101
<script type=text/javascript>
$(document).ready(function() {
$('.carousel').carousel({
interval: 1200
})
});
</script>


If it still is not working, look for potential errors in the browser's (firebug/chrome..) console.






For



Uncaught TypeError: Object # has no method 'carousel' (anonymous function) b.extend.ready jquery.min.js:29 u


Make sure:



Only one jQuery is included



Only one bootstrap-carousel.js or bootstrap.js is included.



jQuery is included first, then bootstrap-carousel.js or bootstrap.js, then $(document).ready( ...


[#84620] Tuesday, June 26, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
gordonrockym

Total Points: 95
Total Questions: 115
Total Answers: 95

Location: Iraq
Member since Sat, Apr 16, 2022
2 Years ago
gordonrockym questions
Mon, Jan 17, 22, 00:00, 2 Years ago
Fri, Nov 12, 21, 00:00, 3 Years ago
Sat, Apr 10, 21, 00:00, 3 Years ago
Tue, Feb 23, 21, 00:00, 3 Years ago
Tue, Dec 1, 20, 00:00, 4 Years ago
;