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')
})