当窗口大小为767px或更小时,如何使bxslider不自动旋转?这是我的代码
var slider = $('.bxslider-wrapper').bxSlider({
autoHover: true,
tickerHover: true,
controls: false,
pause: options.auto != '' ? options.auto : 4000,
pager: options.showControls ? options.showControls : false,
auto: options.auto != '' ? true : false,
infiniteLoop: options.continuous ? options.continuous : false,
touchEnabled: isTouchableDevice()
});
答案 0 :(得分:1)
保持简单:
$(document).ready( function () {
var width = $(window).width(); // get width of viewport
if(width > 776) {
var slider = $('.bxslider-wrapper').bxSlider({
autoHover: true,
tickerHover: true,
controls: false,
pause: options.auto != '' ? options.auto : 4000,
pager: options.showControls ? options.showControls : false,
auto: false
infiniteLoop: options.continuous ? options.continuous : false,
touchEnabled: isTouchableDevice()
});
} else {
var slider = $('.bxslider-wrapper').bxSlider({
autoHover: true,
tickerHover: true,
controls: false,
pause: options.auto != '' ? options.auto : 4000,
pager: options.showControls ? options.showControls : false,
auto: true
infiniteLoop: options.continuous ? options.continuous : false,
touchEnabled: isTouchableDevice()
});
}
});
您可能需要添加一个事件来更新屏幕大小调整上的宽度变量。