如题。
js:
<script language="Javascript">
document.oncontextmenu=new Function("event.returnValue=false");
document.onselectstart=new Function("event.returnValue=false");
</script>
---
html:
<body onmousewheel="return false;" ondragstart="return false;">
css:
body{overflow: hidden;}
我已经设置相关代码禁止页面被滚动,但是还有两个操作方式不知道怎么禁止(1.按空格键翻页2.按住鼠标拖拽页面)
求大神教教我,并用<script language="Javascript"> *</script> 方式帮忙写一下,不甚感谢
document.addEventListener && document.addEventListener('dragstart',function(e){
e.preventDefault();
},false);
document.ondragstart = function(e) {
e.preventDefault();
};
禁止拖拽试试这个
禁止空格键翻页,如下:
$("body").bind("keydown",function(e){
e=window.event||e;
//禁止空格键翻页
if(event.keyCode==32){
return false;
}
});
另外一个禁止按住鼠标拖拽页面,我不太清楚怎么实现,坐等大神。。。
相关链接:
jQuery禁用快捷键例如禁用F5刷新 禁用右键菜单等
onmousewheel=function(){return false;}
在浏览器控制台试了一下可以用