OwlCarousel2-支持触摸屏的响应式jQuery旋转木马插件 Touch enabled jQuery plugin that lets you create a beautiful responsive carousel slider.

Basic Responsive Center Merge Auto Width Url Hash Nav Events Stage Padding rtl Lazyload Video Animate Autoplay Auto Height Mousewheel

Autoplay

Play Stop

Overview

Autoplay插件有三个选项:

//default settings:
autoplay:false
autoplayTimeout:5000
autoplayHoverPause:false

在这个例子中添加了两个自定义按钮来播放和停止旋转木马:

var owl = $('.owl-carousel');
owl.owlCarousel({
    items:4,
    loop:true,
    margin:10,
    autoplay:true,
    autoplayTimeout:1000,
    autoplayHoverPause:true
});
$('.play').on('click',function(){
    owl.trigger('autoplay.play.owl',[1000])
})
$('.stop').on('click',function(){
    owl.trigger('autoplay.stop.owl')
})