Moving end improves sliding fluidity


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;

Recommended Today

The method of obtaining the resolution of display by pyqt5

The code is as follows import sys from PyQt5.QtWidgets import QApplication, QWidget class Example(QWidget): def __init__(self): super().__init__() self.initUI() #Interface drawing to initui method def initUI(self): self.desktop = QApplication.desktop() #Get display resolution size self.screenRect = self.desktop.screenGeometry() self.height = self.screenRect.height() self.width = self.screenRect.width() print(self.height) print(self.width) #Show window if __name__ == ‘__main__’: #Create applications and objects app […]