我做了一个旋转木马,当我按下这些按钮,我想让它动,但它不动。我怎么能做到呢?
- 代码:**
<div class="container mt-4">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<div class="carousel-indicators">
<button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1">1</button>
<button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="1" aria-label="Slide 2">2</button>
<button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="2" aria-label="Slide 3">3</button>
</div>
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="assets/img/black.png" width="100%" height="300px" alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="assets/img/black.png" width="100%" height="300px" alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="assets/img/black.png" width="100%" height="300px" 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>
</div>
1条答案
按热度按时间fjnneemd1#
这是从official documentation复制的一个工作示例。