为什么我的代码中的 Carousel Slide 不起作用?
Why is the Carousel Slide in my code not working?
我正在尝试使用以下 Bootstrap 代码,但它只显示第一张幻灯片,不会移动到下一张。不确定发生了什么:(
<section id="testimonials">
<div id="carouselExampleSlidesOnly" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<h2 class="testimonial">I no longer have to sniff other dogs for love. I've found the hottest Corgi on TinDog. Woof.</h2>
<img class="testimonial-image" src="images/dog-img.jpg" alt="dog-profile">
<em>Pebbles, New York</em>
</div>
<div class="carousel-item">
<h2 class="testimonial-text">My dog used to be so lonely, but with TinDog's help, they've found the love of their life. I think.</h2>
<img class="testimonial-image" src="images/lady-img.jpg" alt="lady-profile">
<em>Beverly, Illinois</em>
</div>
</div>
</div>
</section>
如果您使用 Bootstrap 5,那么答案将是您在其中一个属性上使用 Bootstrap 3 语法。
data-ride="carousel"
应该是
data-bs-ride="carousel"
我正在尝试使用以下 Bootstrap 代码,但它只显示第一张幻灯片,不会移动到下一张。不确定发生了什么:(
<section id="testimonials">
<div id="carouselExampleSlidesOnly" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<h2 class="testimonial">I no longer have to sniff other dogs for love. I've found the hottest Corgi on TinDog. Woof.</h2>
<img class="testimonial-image" src="images/dog-img.jpg" alt="dog-profile">
<em>Pebbles, New York</em>
</div>
<div class="carousel-item">
<h2 class="testimonial-text">My dog used to be so lonely, but with TinDog's help, they've found the love of their life. I think.</h2>
<img class="testimonial-image" src="images/lady-img.jpg" alt="lady-profile">
<em>Beverly, Illinois</em>
</div>
</div>
</div>
</section>
如果您使用 Bootstrap 5,那么答案将是您在其中一个属性上使用 Bootstrap 3 语法。
data-ride="carousel"
应该是
data-bs-ride="carousel"