这是我的转盘。我需要创建带有多个图像的滑块。它一定有点像netflix的旋转木马。
<div class="container">
<div class="row">
<div class="col-sm-12">
<div id="carouselExampleCaptions" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators d-none">
<li data-target="#carouselExampleCaptions" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleCaptions" data-slide-to="1"></li>
<li data-target="#carouselExampleCaptions" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<div class="row">
<div class="col-xs-4">
<img src="img/10.jpg" class="img-item" alt="...">
</div>
<div class="col-xs-4">
<img src="img/11.jpg" class="img-item" alt="...">
</div>
<div class="col-xs-4">
<img src="img/12.jpg" class="img-item" alt="...">
</div>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleCaptions" 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="#carouselExampleCaptions" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
</div>
我将img封装在col中,并将它们嵌入到一行中。事实上,所有的图片都可以显示,但滑块不起作用!
您是否在文档头中导入了用于引导的JS?
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
除此之外,它应该起作用。但是,如果仍然没有看一下这个例子,并将其与您的例子进行比较:旋转木马示例