Added non-passive event listener to a scroll-blocking 'touchstart' event

前端 未结 4 1699
旧巷少年郎
旧巷少年郎 2021-01-31 16:32

Suddenly today out of nowhere I started getting this one on every page on our website

Added non-passive event listener to a scroll-blocking \'touchstart\' event.         


        
4条回答
  •  有刺的猬
    2021-01-31 17:01

    This solve the problem to me:

    jQuery.event.special.touchstart = {
      setup: function( _, ns, handle ){
        if ( ns.includes("noPreventDefault") ) {
          this.addEventListener("touchstart", handle, { passive: false });
        } else {
          this.addEventListener("touchstart", handle, { passive: true });
        }
      }
    };
    

提交回复
热议问题