最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to start carousel other then first item on page loading - Stack Overflow

programmeradmin1浏览0评论

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.

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.

Share Improve this question edited May 6, 2014 at 16:08 Erik Philips 54.6k11 gold badges131 silver badges156 bronze badges asked Apr 28, 2014 at 7:11 Ammar Hayder KhanAmmar Hayder Khan 1,3354 gold badges22 silver badges49 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 10

in own carousel-2:

owl.owlCarousel({
    startPosition: 2
});

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

$(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);
});

There are few ways how you can achieve this.

  1. You can use Options that are served by the owl-carousel

startPosition Type: Number/String Default: 0

Start position or URL Hash string like '#id'.

            $(".owl-one").owlCarousel({
                startPosition: 0 // 1, 2, 3 
            })
   
  1. You can use Events

to.owl.carousel Type: triggerable Parameter: [position, speed] Goes to position.

 $('.owl-one').trigger("to.owl.carousel", [2, 200]);
发布评论

评论列表(0)

  1. 暂无评论