谁能帮忙修改一下这个鼠标手势的JS代码 document.oncontextmenu=function(){return false;};把这句去掉 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我自己修改成功了,谢谢zhaoxiaoyang帮忙大家帮忙看看还有什么要改进的地方//鼠标手势JS代码来自http://bbs.blueidea.com/viewthread.php?tid=1590928,by myhylidocument.onmousedown=initMotion;document.onmousemove=startMotion;document.onmouseup=endMotion;var sensitive=10;var lastX;var lastY;var isDown=false;var motionList=[];var maxMotionLength=5;var lastMotion=null;var actionList={ "↑":function(){document.body.scrollTop-=document.body.clientHeight*0.875}, "↓":function(){document.body.scrollTop+=document.body.clientHeight*0.875}, "←":function(){history.go(-1)}, "→":function(){history.go(1)}, "↓,←":function(){window.open(pre,"_self")}, "↓,→":function(){window.open(next,"_self")}, "→,↑":function(){scrollTo(0,0)}, "→,↓":function(){scrollTo(0,document.body.scrollHeight);}};function initMotion(){ if(event.button==2) { lastX=event.clientX+document.body.scrollLeft; lastY=event.clientY+document.body.scrollTop; isDown=true; motionList=[]; lastMotion=null; }}function startMotion(){ var currentMotion=null; if(isDown==true){ if(event.clientX+document.body.scrollLeft-lastX>sensitive){ currentMotion="→"; } else if(event.clientX+document.body.scrollLeft-lastX<sensitive*-1){ currentMotion="←"; } else if(event.clientY+document.body.scrollTop-lastY>sensitive){ currentMotion="↓"; } else if(event.clientY+document.body.scrollTop-lastY<sensitive*-1){ currentMotion="↑"; } if(currentMotion!=null){ document.oncontextmenu=function(){return false;};//这里屏蔽右键菜单 lastX=event.clientX+document.body.scrollLeft; lastY=event.clientY+document.body.scrollTop; } if(currentMotion!=null && motionList.length==maxMotionLength && motionList[motionList.length-1]!=currentMotion){ motionList=[]; lastMotion=currentMotion; } else if(currentMotion!=null && (motionList.length==0 || motionList[motionList.length-1]!=currentMotion) && lastMotion!=currentMotion){ motionList[motionList.length]=currentMotion; lastMotion=currentMotion; } window.status="鼠标手势:"+motionList; }}function endMotion(){ if(isDown==true){ isDown=false; var currentAction=actionList[motionList.toString()]; if(currentAction!=null){ currentAction(); } window.status=""; } document.oncontextmenu={return ture;};//这里解除屏蔽} 没改成功....没注意Maxthon的鼠标手势打开了,我还以为修改成功了.... 我已经找到一个JQUERY对象,怎么用after方法将其插入到另一个元素的最后面 为什么?浏览器问题还是脚本问题? 自动填写表单 求思路 60分急求jQuery根据一个文本框的值给其他的两个文本框赋值!谢谢!! 如何实现javaScript年 月 日的联动并且判断闰年(急急急急急急急急急急!!!!!) JavaScript高手来看!谢谢! 请教一个关于html编辑器的问题 IE11中DWR怎么向select中增加数据 问! ES6类的实例属性,报错“Unexpected token "="” JS的innerHTML问题,高人看一下噢 如何解码%
大家帮忙看看还有什么要改进的地方//鼠标手势JS代码来自http://bbs.blueidea.com/viewthread.php?tid=1590928,by myhyli
document.onmousedown=initMotion;
document.onmousemove=startMotion;
document.onmouseup=endMotion;var sensitive=10;
var lastX;
var lastY;
var isDown=false;
var motionList=[];
var maxMotionLength=5;
var lastMotion=null;var actionList=
{
"↑":function(){document.body.scrollTop-=document.body.clientHeight*0.875},
"↓":function(){document.body.scrollTop+=document.body.clientHeight*0.875},
"←":function(){history.go(-1)},
"→":function(){history.go(1)},
"↓,←":function(){window.open(pre,"_self")},
"↓,→":function(){window.open(next,"_self")},
"→,↑":function(){scrollTo(0,0)},
"→,↓":function(){scrollTo(0,document.body.scrollHeight);}
};function initMotion(){
if(event.button==2)
{
lastX=event.clientX+document.body.scrollLeft;
lastY=event.clientY+document.body.scrollTop;
isDown=true;
motionList=[];
lastMotion=null;
}
}function startMotion(){
var currentMotion=null;
if(isDown==true){
if(event.clientX+document.body.scrollLeft-lastX>sensitive){
currentMotion="→";
}
else if(event.clientX+document.body.scrollLeft-lastX<sensitive*-1){
currentMotion="←";
}
else if(event.clientY+document.body.scrollTop-lastY>sensitive){
currentMotion="↓";
}
else if(event.clientY+document.body.scrollTop-lastY<sensitive*-1){
currentMotion="↑";
}
if(currentMotion!=null){
document.oncontextmenu=function(){return false;};//这里屏蔽右键菜单
lastX=event.clientX+document.body.scrollLeft;
lastY=event.clientY+document.body.scrollTop;
}
if(currentMotion!=null && motionList.length==maxMotionLength && motionList[motionList.length-1]!=currentMotion){
motionList=[];
lastMotion=currentMotion;
}
else if(currentMotion!=null && (motionList.length==0 || motionList[motionList.length-1]!=currentMotion) && lastMotion!=currentMotion){
motionList[motionList.length]=currentMotion;
lastMotion=currentMotion;
}
window.status="鼠标手势:"+motionList;
}
}function endMotion(){
if(isDown==true){
isDown=false;
var currentAction=actionList[motionList.toString()];
if(currentAction!=null){
currentAction();
}
window.status="";
}
document.oncontextmenu={return ture;};//这里解除屏蔽
}
没注意Maxthon的鼠标手势打开了,我还以为修改成功了....