var oBody = document.querySelector("body");
oBody.addEventListener("touchmove", preventDefault,{ passive: false })
function preventDefault(e){
e.preventDefault()
}
var collection = document.querySelector("#collection");
collection.addEventListener("click", function(e){
if(e.target.id == "callection" || Boolean(e.target.classList.value.indexOf("callection_close") != -1)){
oBody.removeChild(callection);
oBody.removeEventListener("touchmove", preventDefault, false);
}
})
监听body的滑动事件 通过e.preventDefault(); 阻止默认事件;
监听 浮层节点 点击关闭 或 空白处 删除浮层并删除body 的滑动事件监听
这个不能阻止电脑端滚轮滑动