gpt4 book ai didi

javascript - Bootstrap 轮播 - 一张一张显示多张幻灯片时出现问题

转载 作者:行者123 更新时间:2023-11-28 02:15:13 32 4
gpt4 key购买 nike

大家好,我正在研究 bootstrap carousal。我试图在箭头单击时一张一张地显示多张幻灯片。我已经使用了一些代码并且它有点工作但不是预期的。我只想在点击时移动一张图片。但是,这里整个图像幻灯片都在移动。请帮我在点击时只移动一张图片。提前致谢。

$('#Carousel').carousel({
interval: 4000
})
$('#Carousel .item').each(function() {
var next = $(this).next();
if (!next.length) {
next = $(this).siblings(':first');
}
next.children(':first-child').clone().appendTo($(this));

for (var i = 0; i < 2; i++) {
next = next.next();
if (!next.length) {
next = $(this).siblings(':first');
}

next.children(':first-child').clone().appendTo($(this));
}
});
.dashboard-menu-wrapper {
display: none
}

.carousel-inner .active.left {
left: -10%;
}

.carousel-inner .next {
left: 10%;
}

.carousel-inner .prev {
left: -10%;
}

.carousel-control {
width: 4%;
}

.carousel-control.left,
.carousel-control.right {
background-image: none !important;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="col-md-12">
<div class="carousel slide" id="Carousel">
<div class="carousel-inner">
<div class="item active">
<div class="col-xs-3">
<a href="#"><img src="http://placehold.it/500/e499e4/fff&amp;text=1" class="img-responsive"></a>
</div>
</div>
<div class="item">
<div class="col-xs-3">
<a href="#"><img src="http://placehold.it/500/e477e4/fff&amp;text=2" class="img-responsive"></a>
</div>
</div>
<div class="item">
<div class="col-xs-3">
<a href="#"><img src="http://placehold.it/500/eeeeee&amp;text=3" class="img-responsive"></a>
</div>
</div>
<div class="item">
<div class="col-xs-3">
<a href="#"><img src="http://placehold.it/500/f4f4f4&amp;text=4" class="img-responsive"></a>
</div>
</div>
<div class="item">
<div class="col-xs-3">
<a href="#"><img src="http://placehold.it/500/f566f5/333&amp;text=5" class="img-responsive"></a>
</div>
</div>
<div class="item">
<div class="col-xs-3">
<a href="#"><img src="http://placehold.it/500/f477f4/fff&amp;text=6" class="img-responsive"></a>
</div>
</div>
<div class="item">
<div class="col-xs-3">
<a href="#"><img src="http://placehold.it/500/eeeeee&amp;text=7" class="img-responsive"></a>
</div>
</div>
<div class="item">
<div class="col-xs-3">
<a href="#"><img src="http://placehold.it/500/fcfcfc/333&amp;text=8" class="img-responsive"></a>
</div>
</div>
</div>
<a class="left carousel-control" href="#Carousel" data-slide="prev"><i class="glyphicon glyphicon-chevron-left"></i></a>
<a class="right carousel-control" href="#Carousel" data-slide="next"><i class="glyphicon glyphicon-chevron-right"></i></a>
</div>
</div>

最佳答案

要获得所需的结果,您可以使用不同的轮播。我一直在尝试使用 bootstrap 做很多相同的事情,但无法获得结果。

OWL 旋转木马 https://owlcarousel2.github.io使用对齐的元素工作真的很容易......

查看演示:https://owlcarousel2.github.io/OwlCarousel2/demos/basic.html

关于javascript - Bootstrap 轮播 - 一张一张显示多张幻灯片时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48515238/

32 4 0
文章推荐: c++ - 从独立的 TU 零碎地构建静态数据结构
文章推荐: php - 为什么这个动态生成的
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com