为什么轮播在最后一张幻灯片后消失了?
Why does the carousel dissappear after the last last slide?
我正在练习 bootstrap,当我在最后一张幻灯片后单击时,整个轮播消失了。即使在第一张幻灯片上,当我单击向左箭头转到最后一张幻灯片时,整个内容仍然消失了。
<!-- Team Pictures Carousel -->
<div class="row bg-dark rounded-bottom">
<div class="col">
<!-- Carousel Component -->
<div id="carouselExampleControls" class="carousel slide w-50 mx-auto" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://content.codecademy.com/courses/learn-bootstrap-4/adhoc/brian.png" class="d-block w-100" alt="some guy named brian">
<div class="carousel-caption bg-dark rounded-pill py-0">
<p class="text-center font-weight-bold mb-0">CEO: <span class="font-weight-light">Brian M.</span></p>
</div>
</div>
<div class="carousel-item">
<img src="https://content.codecademy.com/courses/learn-bootstrap-4/adhoc/andy.png" class="d-block w-100" alt="another dude named andy">
<div class="carousel-caption bg-dark rounded-pill py-0">
<p class="text-center font-weight-bold mb-0">CFO: <span class="font-weight-light"> Andy C.</span></p>
</div>
</div>
<div class="carousel-item">
<img src="https://content.codecademy.com/courses/learn-bootstrap-4/adhoc/angela.png" class="d-block w-100" alt="angela?">
<div class="carousel-caption bg-dark rounded-pill py-0">
<p class="text-center font-weight-bold mb-0">COO: <span class="font-weight-light">Angela W.</span></p>
</div>
<div class="carousel-item">
<img src="https://content.codecademy.com/courses/learn-bootstrap-4/adhoc/amie.png" class="d-block w-100" alt="amie or amy?">
<div class="carousel-caption bg-dark rounded-pill py-0">
<p class="text-center font-weight-bold mb-0">CTO: <span class="font-weight-light">Amie S.</span></p>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleControls" 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="#carouselExampleControls" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
</div>
带有“COO”的项目缺少关闭标签,因此“carousel-inner”div 在错误的位置关闭。这很好用:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns" crossorigin="anonymous"></script>
<div class="row bg-dark rounded-bottom">
<div class="col">
<!-- Carousel Component -->
<div id="carouselExampleControls" class="carousel slide w-50 mx-auto" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://content.codecademy.com/courses/learn-bootstrap-4/adhoc/brian.png" class="d-block w-100" alt="some guy named brian">
<div class="carousel-caption bg-dark rounded-pill py-0">
<p class="text-center font-weight-bold mb-0">CEO: <span class="font-weight-light">Brian M.</span></p>
</div>
</div>
<div class="carousel-item">
<img src="https://content.codecademy.com/courses/learn-bootstrap-4/adhoc/andy.png" class="d-block w-100" alt="another dude named andy">
<div class="carousel-caption bg-dark rounded-pill py-0">
<p class="text-center font-weight-bold mb-0">CFO: <span class="font-weight-light"> Andy C.</span></p>
</div>
</div>
<div class="carousel-item">
<img src="https://content.codecademy.com/courses/learn-bootstrap-4/adhoc/angela.png" class="d-block w-100" alt="angela?">
<div class="carousel-caption bg-dark rounded-pill py-0">
<p class="text-center font-weight-bold mb-0">COO: <span class="font-weight-light">Angela W.</span></p>
</div>
</div>
<div class="carousel-item">
<img src="https://content.codecademy.com/courses/learn-bootstrap-4/adhoc/amie.png" class="d-block w-100" alt="amie or amy?">
<div class="carousel-caption bg-dark rounded-pill py-0">
<p class="text-center font-weight-bold mb-0">CTO: <span class="font-weight-light">Amie S.</span></p>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleControls" 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="#carouselExampleControls" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
我正在练习 bootstrap,当我在最后一张幻灯片后单击时,整个轮播消失了。即使在第一张幻灯片上,当我单击向左箭头转到最后一张幻灯片时,整个内容仍然消失了。
<!-- Team Pictures Carousel -->
<div class="row bg-dark rounded-bottom">
<div class="col">
<!-- Carousel Component -->
<div id="carouselExampleControls" class="carousel slide w-50 mx-auto" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://content.codecademy.com/courses/learn-bootstrap-4/adhoc/brian.png" class="d-block w-100" alt="some guy named brian">
<div class="carousel-caption bg-dark rounded-pill py-0">
<p class="text-center font-weight-bold mb-0">CEO: <span class="font-weight-light">Brian M.</span></p>
</div>
</div>
<div class="carousel-item">
<img src="https://content.codecademy.com/courses/learn-bootstrap-4/adhoc/andy.png" class="d-block w-100" alt="another dude named andy">
<div class="carousel-caption bg-dark rounded-pill py-0">
<p class="text-center font-weight-bold mb-0">CFO: <span class="font-weight-light"> Andy C.</span></p>
</div>
</div>
<div class="carousel-item">
<img src="https://content.codecademy.com/courses/learn-bootstrap-4/adhoc/angela.png" class="d-block w-100" alt="angela?">
<div class="carousel-caption bg-dark rounded-pill py-0">
<p class="text-center font-weight-bold mb-0">COO: <span class="font-weight-light">Angela W.</span></p>
</div>
<div class="carousel-item">
<img src="https://content.codecademy.com/courses/learn-bootstrap-4/adhoc/amie.png" class="d-block w-100" alt="amie or amy?">
<div class="carousel-caption bg-dark rounded-pill py-0">
<p class="text-center font-weight-bold mb-0">CTO: <span class="font-weight-light">Amie S.</span></p>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleControls" 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="#carouselExampleControls" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
</div>
带有“COO”的项目缺少关闭标签,因此“carousel-inner”div 在错误的位置关闭。这很好用:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns" crossorigin="anonymous"></script>
<div class="row bg-dark rounded-bottom">
<div class="col">
<!-- Carousel Component -->
<div id="carouselExampleControls" class="carousel slide w-50 mx-auto" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://content.codecademy.com/courses/learn-bootstrap-4/adhoc/brian.png" class="d-block w-100" alt="some guy named brian">
<div class="carousel-caption bg-dark rounded-pill py-0">
<p class="text-center font-weight-bold mb-0">CEO: <span class="font-weight-light">Brian M.</span></p>
</div>
</div>
<div class="carousel-item">
<img src="https://content.codecademy.com/courses/learn-bootstrap-4/adhoc/andy.png" class="d-block w-100" alt="another dude named andy">
<div class="carousel-caption bg-dark rounded-pill py-0">
<p class="text-center font-weight-bold mb-0">CFO: <span class="font-weight-light"> Andy C.</span></p>
</div>
</div>
<div class="carousel-item">
<img src="https://content.codecademy.com/courses/learn-bootstrap-4/adhoc/angela.png" class="d-block w-100" alt="angela?">
<div class="carousel-caption bg-dark rounded-pill py-0">
<p class="text-center font-weight-bold mb-0">COO: <span class="font-weight-light">Angela W.</span></p>
</div>
</div>
<div class="carousel-item">
<img src="https://content.codecademy.com/courses/learn-bootstrap-4/adhoc/amie.png" class="d-block w-100" alt="amie or amy?">
<div class="carousel-caption bg-dark rounded-pill py-0">
<p class="text-center font-weight-bold mb-0">CTO: <span class="font-weight-light">Amie S.</span></p>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleControls" 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="#carouselExampleControls" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>