javascript 如何在页面加载时启动轮播,而不是第一个项目

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23334692/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 00:44:17  来源:igfitidea点击:

How to start carousel other then first item on page loading

javascriptjquerycarouselowl-carousel

提问by Ammar Hayder Khan

In certain case i want to start the owl carousel from >3 item i.e carousel by defult shows item from 3rd number.. i have seen the documentation their is no such customization option available.How i can achieve this.

在某些情况下,我想从 > 3 项开始 owl carousel,即 carousel by defult 显示项目从 3rd number.. 我看过文档,他们没有这样的自定义选项可用。我如何实现这一点。

回答by Anuj Khandelwal

in own carousel-2:

own carousel-2

owl.owlCarousel({
    startPosition: 2
});

回答by Iqbal Fauzi

There's jumptTomethod on it, you can call it right after creating the own carousel :

上面有jumptTo方法,您可以在创建自己的轮播后立即调用它:

$(document).ready(function() {

    var owl = $("#owl-demo").owlCarousel({

        autoPlay: 3000, //Set AutoPlay to 3 seconds

        items : 4,
        itemsDesktop : [1199,3],
        itemsDesktopSmall : [979,3]

    });

    // Now move the carousel to the third item.
    owl = $("#owl-demo").data('owlCarousel');
    owl.jumpTo(3);
});