你们都在失去理智.我在这个网站上花了好几天,其他人尝试了不同的代码片段.
当我在jsfiddle预览时,一切都很好.但在我的网站上,它不会自动播放,我也无法点击导航按钮.救命!
现场网站:www.zjscreations.com
<section>
<script>
$(function() {
$('#myCarousel').carousel({
interval: 2000
});
});
</script>
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<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>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="images/Hanna Edens Headshot - Alki Beach.jpg" alt="Hanna Edens Heashot - Alki Beach" class="img-responsive">
</div>
<div class="item">
<img src="images/Stella Salsbury - Dog Portrait.jpg" alt="Stella Salsbury - Dog Portrait" class="img-responsive">
</div>
<div class="item">
<img src="/images/Hanna Edens Headshot - Seattle Skyline.jpg" alt="Hanna Edens Heashot - Seattle Skyline" class="img-responsive">
</div>
</div>
<!-- Left and right controls -->
<a class="carousel-control left" href="#my_carousel" data-slide = "prev">
<span class="icon-prev left"></span>
</a>
<a class="carousel-control right" href="#my_carousel" data-slide = "next">
<span class="icon-next right"></span>
</a>
</div>
</section>
最佳答案 在您的网站上测试后,它显示jQuery库未正确加载,您提供的路径似乎不准确.尝试修复jQuery js文件的url.