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.

max
  • 8,632
  • 3
  • 21
  • 55

1 Answers1

1

You can disable and enable scrollify plugin when you reach your breakpoint like this:

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

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

You can include debounce function, so disable and enable will fire only 50ms after resizing is done (check Codepen example).

CODEPEN

max
  • 8,632
  • 3
  • 21
  • 55