使用轮播滑块构建页面。
Bootsrap 4 Carousel无效:
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="carousel-item active">
<img class="d-block img-fluid" src="/wp-content/themes/tarps/assets/img/aaatarps-banner.png" alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="/wp-content/themes/tarps/assets/img/aaatarps-banner.png" alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="..." alt="Third slide">
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<script>
$('.carousel').carousel({
interval: 2000})
</script>
当我打开Chrome开发者工具时,Chrome控制台会显示错误,如下所示:
Uncaught ReferenceError: $ is not defined
不太清楚我错过了什么?
答案 0 :(得分:-2)
问题是与js资源的链接。