gpt4 book ai didi

javascript - Owl Carousel n by n

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

使用 owl carousel 并尝试五个五个地滑动项目,现在我有 5 个项目,我希望当我按下一个或上一个按钮时它移动到下一个五个项目,目前它移动到下一个项目,这可能吗?

$('.owl-carousel').owlCarousel({
loop:true,
items:5,
margin:10,
nav:true
})

Demo

我用谷歌搜索并检查了插件网站,但找不到任何东西。

最佳答案

使用 slideBy owlCarousel 配置中的选项:

$('.owl-carousel').owlCarousel({
loop:true,
items: 5,
margin:10,
slideBy: 5, // slide 5 items
nav:true
})
.item {
background: red;
}
<link href="https://owlcarousel2.github.io/OwlCarousel2/assets/css/docs.theme.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://owlcarousel2.github.io/OwlCarousel2/assets/owlcarousel/assets/owl.carousel.min.css" rel="stylesheet"/>
<link href="https://owlcarousel2.github.io/OwlCarousel2/assets/owlcarousel/assets/owl.theme.default.min.css" rel="stylesheet"/>
<script src="https://owlcarousel2.github.io/OwlCarousel2/assets/owlcarousel/owl.carousel.js"></script>
<div class="owl-carousel owl-theme">
<div class="item"><h4>1</h4></div>
<div class="item"><h4>2</h4></div>
<div class="item"><h4>3</h4></div>
<div class="item"><h4>4</h4></div>
<div class="item"><h4>5</h4></div>
<div class="item"><h4>6</h4></div>
<div class="item"><h4>7</h4></div>
<div class="item"><h4>8</h4></div>
<div class="item"><h4>9</h4></div>
<div class="item"><h4>10</h4></div>
<div class="item"><h4>11</h4></div>
<div class="item"><h4>12</h4></div>
</div>

关于javascript - Owl Carousel n by n,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43810870/

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