我try 使用下面的 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"

Html相关问答推荐

使用固定的HTML代码创建两个可向右滚动的行

D3.js—分组条形图—更新输入数据时出错

将网格包装在css中

如何在一张表中逃脱边境坍塌--崩溃?

是否可以部分列出一个HTML有序列表

如何更改计时器S输入的Angular 字体大小?

不能以Angular 更改输入的S边框 colored颜色

子元素的单一背景

如何使用Reaction Js读取html文件中的代码

CSS中的转换属性是如何工作的?

Chrome浏览器错误:上的主题验证判断https://pagead2.googlesyndication.com/失败

错误时交换表单,成功时使用HTMX重定向

如何使用多边形制作如图所示的背景

当浏览器宽度减小时字体大小变得太大

如何调整边框半径以匹配父边框半径