gpt4 book ai didi

javascript - 一次两个滑动图像

转载 作者:行者123 更新时间:2023-12-01 05:44:48 24 4
gpt4 key购买 nike

我已经根据其中一个引用制作了一个 slider ,但我想一次显示 2 个图像。如何实现这一目标。请查看链接

Slider

上面是我编码的链接。

请查看链接的 HTML

<div class="container">
<div class="row well">
<div class="col-xs-8 col-sm-6 col-md-6">
<h2>Vertical Slider</h2>
<div id="myCarousel" class="vertical-slider carousel vertical slide col-md-12" data-ride="carousel">
<div class="row">
<div class="col-md-4">
<span data-slide="next" class="btn-vertical-slider glyphicon glyphicon-circle-arrow-up "
style="font-size: 30px"></span>
</div>
<div class="col-md-8">
</div>
</div>
<br />
<!-- Carousel items -->
<div class="carousel-inner">
<div class="item active">
<div class="row">
<div class="col-xs-6 col-sm-5 col-md-5">
<a href="http://dotstrap.com/">
<img src="http://placehold.it/150x150" class="thumbnail"
alt="Image" /></a>
</div>
<div class="col-xs-6 col-sm-7 col-md-7">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh
euismod tincidunt ut laoreet..
</div>
</div>
<!--/row-fluid-->
</div>
<!--/item-->
<div class="item ">
<div class="row">
<div class="col-xs-6 col-sm-5 col-md-5">
<a href="http://dotstrap.com/">
<img src="http://placehold.it/150x150" class="thumbnail"
alt="Image" /></a>
</div>
<div class="col-xs-6 col-sm-7 col-md-7">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh
euismod tincidunt ut laoreet..
</div>
</div>
<!--/row-fluid-->
</div>
<!--/item-->
<div class="item ">
<div class="row">
<div class="col-xs-6 col-sm-5 col-md-5">
<a href="http://dotstrap.com/">
<img src="http://placehold.it/150x150" class="thumbnail"
alt="Image" /></a>
</div>
<div class="col-xs-6 col-sm-7 col-md-7">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh
euismod tincidunt ut laoreet..
</div>
</div>
<!--/row-fluid-->
</div>
<!--/item-->
</div>
<div class="row">
<div class="col-md-4">
<span data-slide="prev" class="btn-vertical-slider glyphicon glyphicon-circle-arrow-down"
style="color: Black; font-size: 30px"></span>
</div>
<div class="col-md-8">
</div>
</div>
</div>
</div>
</div>
</div>

我引用的链接:-

Reference link

最佳答案

您需要添加用于滑动的轮播代码,如下所示:-

$(document).ready(function () {
$('.btn-vertical-slider').on('click', function () {
setInterval(function () { slide(dir); }, 1000);
if ($(this).attr('data-slide') == 'next') {
$('#myCarousel').carousel('next');
}
if ($(this).attr('data-slide') == 'prev') {
$('#myCarousel').carousel('prev')
}
});
$('.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));
}
});
});

关于javascript - 一次两个滑动图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27915932/

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