gpt4 book ai didi

jquery - 如何在 Bootstrap 4 轮播中堆叠多个图像

转载 作者:行者123 更新时间:2023-11-28 15:12:49 24 4
gpt4 key购买 nike

我不知道如何使用 Bootstrap 4,以及如何在一张幻灯片中显示多个小图像(如缩略图),而不是让图像填满轮播的宽度。我已经用下面的代码尝试了几件事,但仍然无法堆叠很多图像。

<div class="container">
<h2 class="text-center">- Carousel -</h2><br>

<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="http://via.placeholder.com/250x250" alt="First slide">
</div>
<div class="carousel-item">
<img src="http://via.placeholder.com/250x250" alt="Second slide">
</div>
<div class="carousel-item">
<img src="http://via.placeholder.com/250x250" alt="Third slide">
</div>
<div class="carousel-item">
<img src="http://via.placeholder.com/250x250" alt="Fourth slide">
</div>
<div class="carousel-item">
<img src="http://via.placeholder.com/250x250" alt="Fifth slide">
</div>
<div class="carousel-item">
<img src="http://via.placeholder.com/250x250" alt="Sixth slide">
</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>

如果你想看例子,可以访问https://www.rhtacademy.com/并查看“亮点”部分。

最佳答案

您可以使用标准的 Bootstrap Grid system轮播幻灯片中的类也是如此。因此,您可以实现在 example 中看到的行为使用下面示例中的标记。
该示例在一张幻灯片中显示了五张图片,一旦轮播滑到下一个元素,它将显示下一个包含五张图片的 block 。

<div id="gallery" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<div class="row">
<div class="col">
<img class="img-fluid" src="http://via.placeholder.com/800x450/caa8f5/ffffff?text=Image+1" alt="Image 1"/>
</div>

<div class="col">
<img class="img-fluid" src="http://via.placeholder.com/800x450/9984d4/ffffff?text=Image+2" alt="Image 2"/>
</div>

<div class="col">
<img class="img-fluid" src="http://via.placeholder.com/800x450/592e83/ffffff?text=Image+3" alt="Image 3"/>
</div>

<div class="col">
<img class="img-fluid" src="http://via.placeholder.com/800x450/230c33/ffffff?text=Image+4" alt="Image 4"/>
</div>

<div class="col">
<img class="img-fluid" src="http://via.placeholder.com/800x450/b27c66/ffffff?text=Image+5" alt="Image 5"/>
</div>
</div>
</div>

<div class="carousel-item">
<div class="row">
<div class="col">
<img class="img-fluid" src="http://via.placeholder.com/800x450/f35b04/ffffff?text=Image+6" alt="Image 6"/>
</div>

<div class="col">
<img class="img-fluid" src="http://via.placeholder.com/800x450/f18701/ffffff?text=Image+7" alt="Image 7"/>
</div>

<div class="col">
<img class="img-fluid" src="http://via.placeholder.com/800x450/f7b801/ffffff?text=Image+8" alt="Image 8"/>
</div>

<div class="col">
<img class="img-fluid" src="http://via.placeholder.com/800x450/7678ed/ffffff?text=Image+9" alt="Image 9"/>
</div>

<div class="col">
<img class="img-fluid" src="http://via.placeholder.com/800x450/3d348b/ffffff?text=Image+10" alt="Image 10"/>
</div>
</div>
</div>
</div>

<a class="carousel-control-prev" href="#gallery" 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="#gallery" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>


<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script>

关于jquery - 如何在 Bootstrap 4 轮播中堆叠多个图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47961310/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com