无限幻灯片

时间:2019-03-18 04:01:01

标签: jquery slideshow infinite-loop

我需要一些有关无限幻灯片概念的帮助。 我需要的与此图片相似:

enter image description here

好吧,我在HTML和CSS中都具有这种结构,并且在div的背景上使用了imagens,但是我不知道jquery的无限效果如何。有人耐心解释吗?

我找到了一些代码,但是它们并没有像我期望的那样正常工作,因为它具有集中的div以及上一张和下一张幻灯片的一部分。

我说谢谢你从现在开始帮助我的人。

3 个答案:

答案 0 :(得分:1)

使用此插件并制作所需的轮播 https://owlcarousel2.github.io/OwlCarousel2/demos/merge.html

答案 1 :(得分:0)

不幸的是,我不知道如何使这个插件工作者像我需要的那样。 任何有jquery知识的人都可以查看我的示例并尝试帮助解决该问题?

See my example on Codepen

HTML:

<div id="slide">
   <div id="wrapper">

     <div class="item item-3 cloned"> Slide 3 (cloned) </div>
     <div class="item item-1 cloned"> Slide 1 (cloned) </div>
     <div class="item item-2 cloned"> Slide 2 (cloned) </div>

     <div class="item item-3"> Slide 3 </div>
     <div class="item item-1"> Slide 1 </div>
     <div class="item item-2"> Slide 2 </div>

     <div class="item item-3 cloned"> Slide 3 (cloned) </div>
     <div class="item item-1 cloned"> Slide 1 (cloned) </div>
     <div class="item item-2 cloned"> Slide 2 (cloned) </div>

   </div>

   <div id="controls">
     <a id="control-prev"><</a>
     <a id="control-next">></a>
   </div>
</div>

CSS:

See on Codepen example

JQUERY:

See on Codepen example

答案 2 :(得分:0)

查看此演示

$('.owl-carousel').owlCarousel({
    items:5,
    loop:true,
    margin:10,
    merge:true,
    responsive:{
        678:{
            mergeFit:true
        },
        1000:{
            mergeFit:false
        }
    }
});
.item {
	height: 10rem;
	background-color: #4DC7A0;
	padding: 1rem;
	color: #fff;
}
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.theme.default.min.css">
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.theme.green.css">
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.min.css">
<div class="owl-carousel owl-theme">
    <div class="item" data-merge="1"><h2>1</h2></div>
    <div class="item" data-merge="2"><h2>2</h2></div>
    <div class="item" data-merge="1"><h2>3</h2></div>
    <div class="item" data-merge="3"><h2>4</h2></div>
    <div class="item" data-merge="6"><h2>6</h2></div>
    <div class="item" data-merge="2"><h2>7</h2></div>
    <div class="item" data-merge="1"><h2>8</h2></div>
    <div class="item" data-merge="3"><h2>9</h2></div>
    <div class="item"><h2>10</h2></div>
    <div class="item"><h2>11</h2></div>
    <div class="item" data-merge="2"><h2>12</h2></div>
    <div class="item"><h2>13</h2></div>
    <div class="item"><h2>14</h2></div>
    <div class="item"><h2>15</h2></div>
</div>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.js"></script>