Responsive选项可用于设置breakpoints和额外的选项。缩放你的浏览器看看导航和旋转木马如何变化。
设置responsive非常简单。responsive参数的结构如下:
responsive : {
// breakpoint from 0 up
0 : {
option1 : value,
option2 : value,
...
},
// breakpoint from 480 up
480 : {
option1 : value,
option2 : value,
...
},
// breakpoint from 768 up
768 : {
option1 : value,
option2 : value,
...
}
}
默认情况下,responsive参数选项设置为true,所以旋转木马总是试图匹配容器的宽度和高度(甚至是在media queries不被支持的IE7/IE8中也是如此)
responsive:false
。$('.owl-carousel').owlCarousel({
loop:true,
margin:10,
responsiveClass:true,
responsive:{
0:{
items:1,
nav:true
},
600:{
items:3,
nav:false
},
1000:{
items:5,
nav:true,
loop:false
}
}
})
Optional helper class. Add 'owl-reponsive-' + 'breakpoint' class to main element.
As default all responsive breakpoints are corresponding with window
width. This option gives you an opportunity to change it to your own class/id like responsiveBaseElement:".myCustomWrapper"
What this does is wait 200ms after you changed the browser width and performs refresh actions (calculating widths/ cloning items etc.) Default refresh rate is 200ms. I think this rate is optimal but you can change it if it’s to slow for you.
As not every option is able to use responsive abilities, here’s a full list of responsive options.