如何修复 bootstrap 轮播错误?
How to fix bootstrap carousel bug?
旋转木马的最后一个项目没有正确显示并且破坏了旋转木马本身。但是当我注释掉轮播的第三项时,它看起来很好,没有任何东西,轮播中没有最后一项。我该如何修复这个错误?所有必要的东西都已链接,例如 bootstrap、jQuery 和 font-awesome。
<div id="carouselServices" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<div class="row">
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-shield fa-5x"></i>
</div>
<h4 class="text-dark">WPWL MULTI-LANGUAGE SUPPORT</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-cog fa-5x"></i>
</div>
<h4 class="text-dark">FULLY CUSTOMIZABLE THEME</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-bolt fa-5x"></i>
</div>
<h4 class="text-dark">STUNNING UPDATE VERSION 7.0</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
</div>
</div>
<div class="carousel-item">
<div class="row">
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-shield fa-5x"></i>
</div>
<h4 class="text-dark">WPWL MULTI-LANGUAGE SUPPORT</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-cog fa-5x"></i>
</div>
<h4 class="text-dark">FULLY CUSTOMIZABLE THEME</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-bolt fa-5x"></i>
</div>
<h4 class="text-dark">STUNNING UPDATE VERSION 7.0</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
</div>
<div class="carousel-item">
<div class="row">
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-shield fa-5x"></i>
</div>
<h4 class="text-dark">WPWL MULTI-LANGUAGE SUPPORT</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-cog fa-5x"></i>
</div>
<h4 class="text-dark">FULLY CUSTOMIZABLE THEME</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-bolt fa-5x"></i>
</div>
<h4 class="text-dark">STUNNING UPDATE VERSION 7.0</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
</div>
</div>
</div>
<ol class="carousel-indicators">
<li data-target="#carouselServices" data-slide-to="0" class="active"></li>
<li data-target="#carouselServices" data-slide-to="1"></li>
<li data-target="#carouselServices" data-slide-to="2"></li>
</ol>
<a href="#carouselServices" class="carousel-control-prev" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a href="#carouselServices" class="carousel-control-next" role="button" data-slide="next">
<span class="carousel-control-next-icon"></span>
<span class="sr-only">Next</span>
</a>
首先将 carousel-indicators
、 carousel-control-prev
和 carousel-control-next
元素移到 carousel-inner div 元素之外。另外,您的 carousel-item
div 之一未关闭。我对代码做了一些修改,请检查它现在是否有效
<div id="carouselServices" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselServices" data-slide-to="0" class="active"></li>
<li data-target="#carouselServices" data-slide-to="1"></li>
<li data-target="#carouselServices" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<div class="row">
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-shield fa-5x"></i>
</div>
<h4 class="text-dark">WPWL MULTI-LANGUAGE SUPPORT</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-cog fa-5x"></i>
</div>
<h4 class="text-dark">FULLY CUSTOMIZABLE THEME</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-bolt fa-5x"></i>
</div>
<h4 class="text-dark">STUNNING UPDATE VERSION 7.0</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
</div>
</div>
<div class="carousel-item">
<div class="row">
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-shield fa-5x"></i>
</div>
<h4 class="text-dark">WPWL MULTI-LANGUAGE SUPPORT</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-cog fa-5x"></i>
</div>
<h4 class="text-dark">FULLY CUSTOMIZABLE THEME</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-bolt fa-5x"></i>
</div>
<h4 class="text-dark">STUNNING UPDATE VERSION 7.0</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
</div>
</div>
<div class="carousel-item">
<div class="row">
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-shield fa-5x"></i>
</div>
<h4 class="text-dark">WPWL MULTI-LANGUAGE SUPPORT</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-cog fa-5x"></i>
</div>
<h4 class="text-dark">FULLY CUSTOMIZABLE THEME</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-bolt fa-5x"></i>
</div>
<h4 class="text-dark">STUNNING UPDATE VERSION 7.0</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
</div>
</div>
</div><!-- ./carousel-inner -->
<a href="#carouselServices" class="carousel-control-prev" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a href="#carouselServices" class="carousel-control-next" role="button" data-slide="next">
<span class="carousel-control-next-icon"></span>
<span class="sr-only">Next</span>
</a>
</div><!-- ./carousel -->
希望对您有所帮助。
旋转木马的最后一个项目没有正确显示并且破坏了旋转木马本身。但是当我注释掉轮播的第三项时,它看起来很好,没有任何东西,轮播中没有最后一项。我该如何修复这个错误?所有必要的东西都已链接,例如 bootstrap、jQuery 和 font-awesome。
<div id="carouselServices" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<div class="row">
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-shield fa-5x"></i>
</div>
<h4 class="text-dark">WPWL MULTI-LANGUAGE SUPPORT</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-cog fa-5x"></i>
</div>
<h4 class="text-dark">FULLY CUSTOMIZABLE THEME</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-bolt fa-5x"></i>
</div>
<h4 class="text-dark">STUNNING UPDATE VERSION 7.0</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
</div>
</div>
<div class="carousel-item">
<div class="row">
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-shield fa-5x"></i>
</div>
<h4 class="text-dark">WPWL MULTI-LANGUAGE SUPPORT</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-cog fa-5x"></i>
</div>
<h4 class="text-dark">FULLY CUSTOMIZABLE THEME</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-bolt fa-5x"></i>
</div>
<h4 class="text-dark">STUNNING UPDATE VERSION 7.0</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
</div>
<div class="carousel-item">
<div class="row">
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-shield fa-5x"></i>
</div>
<h4 class="text-dark">WPWL MULTI-LANGUAGE SUPPORT</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-cog fa-5x"></i>
</div>
<h4 class="text-dark">FULLY CUSTOMIZABLE THEME</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-bolt fa-5x"></i>
</div>
<h4 class="text-dark">STUNNING UPDATE VERSION 7.0</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
</div>
</div>
</div>
<ol class="carousel-indicators">
<li data-target="#carouselServices" data-slide-to="0" class="active"></li>
<li data-target="#carouselServices" data-slide-to="1"></li>
<li data-target="#carouselServices" data-slide-to="2"></li>
</ol>
<a href="#carouselServices" class="carousel-control-prev" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a href="#carouselServices" class="carousel-control-next" role="button" data-slide="next">
<span class="carousel-control-next-icon"></span>
<span class="sr-only">Next</span>
</a>
首先将 carousel-indicators
、 carousel-control-prev
和 carousel-control-next
元素移到 carousel-inner div 元素之外。另外,您的 carousel-item
div 之一未关闭。我对代码做了一些修改,请检查它现在是否有效
<div id="carouselServices" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselServices" data-slide-to="0" class="active"></li>
<li data-target="#carouselServices" data-slide-to="1"></li>
<li data-target="#carouselServices" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<div class="row">
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-shield fa-5x"></i>
</div>
<h4 class="text-dark">WPWL MULTI-LANGUAGE SUPPORT</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-cog fa-5x"></i>
</div>
<h4 class="text-dark">FULLY CUSTOMIZABLE THEME</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-bolt fa-5x"></i>
</div>
<h4 class="text-dark">STUNNING UPDATE VERSION 7.0</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
</div>
</div>
<div class="carousel-item">
<div class="row">
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-shield fa-5x"></i>
</div>
<h4 class="text-dark">WPWL MULTI-LANGUAGE SUPPORT</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-cog fa-5x"></i>
</div>
<h4 class="text-dark">FULLY CUSTOMIZABLE THEME</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-bolt fa-5x"></i>
</div>
<h4 class="text-dark">STUNNING UPDATE VERSION 7.0</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
</div>
</div>
<div class="carousel-item">
<div class="row">
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-shield fa-5x"></i>
</div>
<h4 class="text-dark">WPWL MULTI-LANGUAGE SUPPORT</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-cog fa-5x"></i>
</div>
<h4 class="text-dark">FULLY CUSTOMIZABLE THEME</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
<div class="col-md px-md-5">
<div class="text-dark pb-3">
<i class="fa fa-bolt fa-5x"></i>
</div>
<h4 class="text-dark">STUNNING UPDATE VERSION 7.0</h4>
<br>
<p class="text-secondary">Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro quam iure suscipit minus, ab, distinctio ex voluptatibus, dolorum quisquam incidunt dolores. Atque, eos sit. Fuga, reiciendis? Maiores rerum deleniti illo!</p>
</div>
</div>
</div>
</div><!-- ./carousel-inner -->
<a href="#carouselServices" class="carousel-control-prev" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a href="#carouselServices" class="carousel-control-next" role="button" data-slide="next">
<span class="carousel-control-next-icon"></span>
<span class="sr-only">Next</span>
</a>
</div><!-- ./carousel -->
希望对您有所帮助。