当 window 调整为 776px 或更小时停止 bxslider 自动旋转

Stop auto rotate on bxslider when window resized to 776px and smaller

当 window 大小为 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()
    });

保持简单:

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

您可能想要添加一个事件以在屏幕调整大小时更新宽度变量。