我不明白如何正确添加到Jquery {passive:false}

在代码中,我描述了带有动画延迟的滚动处理,如jquery所述,将来会更容易使用,但由于目标被视为被动,因此在被动事件侦听器中出现错误Unable to preventDefault。任何人都知道如何解决,请告诉我。

$(document).ready(function(){
  $(document).onepage_scroll();
});
!function($){

  var defaults = {
    easing: 'ease',
    animationTime: 1000,
    };


$.fn.swipeEvents = function() {
  return this.each(function() {

    var startX,
        startY,
        $this = $(this);

    $this.bind('touchstart', touchstart);

    function touchstart(event) {
      var touches = event.originalEvent.touches;
      if (touches && touches.length) {
        startX = touches[0].pageX;
        startY = touches[0].pageY;
        $this.bind('touchmove', touchmove);
      }
      event.preventDefault();
    }

    function touchmove(event) {
      var touches = event.originalEvent.touches;
      if (touches && touches.length) {
        var deltaX = startX - touches[0].pageX;
        var deltaY = startY - touches[0].pageY;

        if (deltaX >= 50) {
          $this.trigger('swipeLeft');
        }
        if (deltaX <= -50) {
          $this.trigger('swipeRight');
        }
        if (deltaY >= 50) {
          $this.trigger('swipeUp');
        }
        if (deltaY <= -50) {
          $this.trigger('swipeDown');
        }
        if (Math.abs(deltaX) >= 50 || Math.abs(deltaY) >= 50) {
          $this.unbind('touchmove', touchmove);
        }
      }
      event.preventDefault();
    }

  });
};




$.fn.onepage_scroll = function(options){
    var settings = $.extend({}, defaults, options),
        el = $(this),
        sections = $(settings.sectionContainer);
        let total;
        let topPos;
        let lastAnimation;
        let quietPeriod;
        total = sections.length,
        status = 'off',
        topPos = 0,
        lastAnimation = 0,
        quietPeriod = 500,

    $.fn.moveDown = function() {
      console.log('down');
    }

    $.fn.moveUp = function() {
      console.log('up');
    }

    function init_scroll(event, delta) {
      let deltaOfInterest;
        deltaOfInterest = delta;
        var timeNow = new Date().getTime();
        // Cancel scroll if currently animating or within quiet period
        if(timeNow - lastAnimation < quietPeriod + settings.animationTime) {
            event.preventDefault();
            return;
        }

        if (deltaOfInterest < 0) {
          el.moveDown()
        } else {
          el.moveUp()
        }
        lastAnimation = timeNow;
    }

    // Prepare everything before binding wheel scroll

    el.swipeEvents().bind('swipeDown',  function(){
      el.moveUp();
    }).bind('swipeUp', function(){
      el.moveDown();
    });

    $(document).bind('mousewheel DOMMouseScroll', { passive: true }, function(event) {
      event.preventDefault();
      var delta = event.originalEvent.wheelDelta || -event.originalEvent.detail;
      init_scroll(event, delta);
    });
    return false;

  }

}(window.jQuery);