0

This is the script I want to disable when the browser reaches the Bootstrap breakpoint of 768px width:

$(function() {
  $.scrollify({
    /*section: "section",*/
    interstitialSection: "interstitialSection", 
    offset: 30,
  });
});

Thanks in advance.

4

1 回答 1

1

当您到达断点时,您可以禁用和启用滚动插件,如下所示:

$(window).resize(function() {
  var width = $(this).width();
  if(width < 768) {
    $.scrollify.disable();
  } else {
    $.scrollify.enable();
  }
});

$(window).trigger('resize');

您可以包含去抖动功能,因此在调整大小完成后,禁用和启用只会触发 50 毫秒(检查 Codepen 示例)。

编解码器

于 2017-01-30T22:04:21.143 回答