使用owl carousel并尝试以5到5滑动项目,现在我有5个项目,我想当我按下next或prev按钮时移动到下一个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到n,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43810870/

10-10 21:43