【JS】禁止页面滑动滚动,兼容ios

const PASSIVE = function (e) {
  e.preventDefault();
}

// 禁止

document.body.style.overflow = 'hidden';
document.addEventListener('touchmove', PASSIVE, {
  passive: false,
});

// 恢复

document.body.style.overflow = 'auto';
document.removeEventListener('touchmove', PASSIVE, {
  passive: false,
});

上一篇:eclipse提示:“The superclass “javax.servlet.http.HttpServlet“ was not found on the Java“解决办法


下一篇:浅析 Servlet 的三种创建方法