bootstrap carousel不工作:堆栈图像(使用rails)

时间:2022-11-03 21:45:38

I am developing an app with rails and using bootstrap to style most of it. When I am using the carousel structure it stacks one image above the other. Also I am assuming that the JavaScript it uses might not be running correctly.

我正在开发一个带有rails的应用程序,并使用bootstrap来设置大部分样式。当我使用旋转木马结构时,它将一个图像堆叠在另一个上方。另外我假设它使用的JavaScript可能无法正常运行。

Here is my code

这是我的代码

<section class="carousel"
    <div class="contanier">
      <div class="row">
        <div class="col-sm-12">
          <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
            <ol class="carousel-indicators">
              <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
              <li data-target="#carousel-example-generic" data-slide-to="1"></li>
              <li data-target="#carousel-example-generic" data-slide-to="2"></li>
            </ol>
            <div class="carousel-inner" role="listbox">
              <div class="carousel-item active">
                <%= image_tag("carousel_na_1.jpg") %>
                <div class="carousel-caption">
                  <div class="carousel-caption"
                  <h3>Miel de Agave Natural</h3>
                  <p>¿Que es la miel de Agave?</p>
                </div>
              </div>
            </div>
            <div class="carousel-item">
              <%= image_tag("carousel_na_2.jpg") %>
            </div>
            <div class="carousel-item">
              <%= image_tag("carousel_na_2.jpg") %>
            </div>
          </div>
          <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
            <span class="icon-prev" aria-hidden="true"></span>
            <span class="sr-only">Previous</span>
          </a>
          <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
            <span class="icon-next" aria-hidden="true"></span>
            <span class="sr-only">Next</span>
          </a>
        </div>
      </div>
    </div>
    </div>
    </section>

Here are some images of how it renders: enter image description here

以下是一些渲染方式的图像:在此处输入图像说明

1 个解决方案

#1


0  

Change the carousel-item class to item, and it'll work.

将carousel-item类更改为item,它将起作用。

#1


0  

Change the carousel-item class to item, and it'll work.

将carousel-item类更改为item,它将起作用。