javascript - 如何在两行中显示元素幻灯片?

标签 javascript html css owl-carousel

我有 16 个元素由 4 个在幻灯片的一行中发布

<div class="owl-wrapper-outer">
<div class="owl-item"></div>
<div class="owl-item"></div>
<div class="owl-item"></div>
<div class="owl-item"></div>
<div class="owl-item"></div>
<div class="owl-item"></div>
...
</div>

我想以两行显示它们,每行 4 个,但问题是幻灯片一次更改 4 个

最佳答案

$('.owl-carousel').owlCarousel({
    items:4,
    lazyLoad:true,
    loop:true,
    margin:10,
    autoplay:true,
    autoplayTimeout:3000,
    autoplayHoverPause:true,
});
<link href="https://owlcarousel2.github.io/OwlCarousel2/assets/owlcarousel/assets/owl.carousel.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://owlcarousel2.github.io/OwlCarousel2/assets/owlcarousel/owl.carousel.js"></script>
<div class="owl-carousel owl-theme">
    <img class="owl-lazy" data-src="http://placehold.it/350x250&text=1" data-src-retina="http://placehold.it/350x250&text=1-retina" alt="">
    <img class="owl-lazy" data-src="https://placehold.it/350x250&text=2" data-src-retina="http://placehold.it/350x250&text=2-retina" alt="">
    <img class="owl-lazy" data-src="http://placehold.it/350x250&text=3" alt="">
    <img class="owl-lazy" data-src="http://placehold.it/350x250&text=4" alt="">
    <img class="owl-lazy" data-src="http://placehold.it/350x250&text=5" alt="">
    <img class="owl-lazy" data-src="http://placehold.it/350x250&text=6" alt="">
    <img class="owl-lazy" data-src="http://placehold.it/350x250&text=7" alt="">
    <img class="owl-lazy" data-src="http://placehold.it/350x250&text=8" alt="">
    <img class="owl-lazy" data-src="http://placehold.it/350x250&text=9" alt="">
    <img class="owl-lazy" data-src="http://placehold.it/350x250&text=10" alt="">
    <img class="owl-lazy" data-src="http://placehold.it/350x250&text=11" alt="">
</div>
<br>
<div class="owl-carousel owl-theme" >
    <img class="owl-lazy" data-src="http://placehold.it/350x250&text=1" data-src-retina="http://placehold.it/350x250&text=1-retina" alt="">
    <img class="owl-lazy" data-src="https://placehold.it/350x250&text=2" data-src-retina="https://placehold.it/350x250&text=2-retina" alt="">
    <img class="owl-lazy" data-src="http://placehold.it/350x250&text=3" alt="">
    <img class="owl-lazy" data-src="http://placehold.it/350x250&text=4" alt="">
    <img class="owl-lazy" data-src="http://placehold.it/350x250&text=5" alt="">
    <img class="owl-lazy" data-src="http://placehold.it/350x250&text=6" alt="">
    <img class="owl-lazy" data-src="http://placehold.it/350x250&text=7" alt="">
    <img class="owl-lazy" data-src="http://placehold.it/350x250&text=8" alt="">
    <img class="owl-lazy" data-src="http://placehold.it/350x250&text=9" alt="">
    <img class="owl-lazy" data-src="http://placehold.it/350x250&text=10" alt="">
    <img class="owl-lazy" data-src="http://placehold.it/350x250&text=11" alt="">
</div>

关于javascript - 如何在两行中显示元素幻灯片?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46010702/

相关文章:

css - 与内联 block 的间隙不一致

html - 我在一个 div 中有 p 元素,它们的高度都为 50px。为什么p向下移动?

javascript - 单击搜索区域时,程序后退一步(Javascript)

javascript - react 上下文重新渲染提供者的每个 child ?

javascript - 从数据库中检索正则表达式在java和javascript中是不同的

javascript - 音频文件数组

javascript - 使按钮在不移动鼠标时消失并在移动时出现

php - PHP 中的 ul 列表无法正常工作

css - HTML5中一个div向左浮动,两个div向右浮动

javascript - 如果条件正确,为什么序列不起作用?