我已經在教程中完成了這個工作,它完美地工作,現在當我重新創建它時它拒絕工作,我將提供代碼和錯誤報告。Twitter Bootstrap - Carousel
HTML:
<div class="carousel slide" id="myCarousel">
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
<li data-target="#myCarousel" data-slide-to="3"></li>
</ol>
<div class="carousel-inner">
<div class="item active"><img src="http://placehold.it/1200x480" alt="placeholdit"></div>
<div class="item"><img src="http://placehold.it/1200x481" alt="placeholdit"></div>
<div class="item"><img src="http://placehold.it/1200x480" alt="placeholdit"></div>
<div class="item"><img src="http://placehold.it/1200x482" alt="placeholdit"></div>
</div>
</div>
JS:(文件鏈接被放置在身體,所以是代碼)
<script src="js/bootstrap.js"></script>
<script src="js/jquery.js"></script>
<script>
$(document).ready(function() {
$('#myCarousel').carousel({interval: 2000});
});
</script>
錯誤報告:
TypeError: $ is not a function file:///C:/Users/Christopher/Desktop/Portfolio_Final/js/bootstrap.js Line 29
TypeError: $(...).carousel is not a function file:///C:/Users/Christopher/Desktop/Portfolio_Final/index.html#myCarousel Line 89
看起來,它的函數報告錯誤不存在,jquery版本是1.9.1
謝謝你,這麼簡單的東西,容易被忽視,欣賞它。 –