js 禁止鼠标滚动

xiaoxiao2021-02-28  95

window.onload=function(){ var oDiv=document.getElementById("top"); oDiv.onmouseover = function () { if(window.event){ document.onmousewheel = function () { window.event.returnValue="false"; return false; } }else{ oDiv.addEventListener("DOMMouseScroll",function(ev){ev.preventDefault();} , false); } }; oDiv.onmouseout=function(){ document.onmousewheel=null; } }
转载请注明原文地址: https://www.6miu.com/read-66486.html

最新回复(0)