Moving end improves sliding fluidity

Time:2019-10-9

1. Recently, the iscroll plug-in has been used to slide webApp. There has been a Karton phenomenon. Baidu was originally a browser that did not know whether to implement default events in advance. Only when the processing function has been executed can it be known that even empty execution function will cause karton.
2. Passive is used to solve this problem by telling the browser in advance whether to block default events.


document.addEventListener('touchmove', function (e) { e.preventDefault(); }, isPassive() ? {
    capture: false,
    passive: false
} : false);

function isPassive() {
  var supportsPassiveOption = false;
  try {
    addEventListener("test", null, Object.defineProperty({}, 'passive', {
      get: function () {
        supportsPassiveOption = true;
      }
    }));
  } catch(e) {}
  return supportsPassiveOption;
}

https://www.cnblogs.com/ziyun…