管理 Shorcut,然后单击 Browser with JQuery
Managing Shorcut and click Browser with JQuery
在这种情况下,我使用最新版本的Mozilla Firefox作为我的浏览器。
我想禁用浏览器中的所有事件单击,然后我想更改键盘上的一些 Shorcut 浏览器,如 F5、F6 等。
这是我有的代码
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<script type="text/javascript">
$(function(){
$('body').keypress(function(e){
e.preventDefault();
if(e.which == 116) //for f5
{
alert("ok"); //execute module
}
else if(e.which == 117) //for f6
{
alert("ok");
}
});
$('body').off("click"); //disable all click function
});
</script>
直到我问这个问题,这段代码不起作用,有没有办法解决这个问题?
而不是
$('body').off("click"); //disable all click function
尝试
$('body *').off("click"); //disable all click function
但是在使用.off()
时请记住,它只会删除与.on()
附加的事件处理程序。
这是使用 jquery 禁用右键单击的脚本。 您还可以在右键单击触发时添加自己的函数。
$('body').on('contextmenu', function(){
//you can write your own code to display a menu
return false;
});
相关文章:
- Fighting with FRP
- issue with FB.Event.subscribe
- geolocation-marker.js conflict with markerclusterer.js
- Angular 2.0 with JavaScript or TypeScript?
- 为什么不推荐使用“with”?是否有更好或其他方法可以“下降”到对象的命名空间
- WebComponentsJS with IE10
- 指令的模板必须只有一个根元素:With restrict E&替换true
- timeago.js with datatable and PHP
- Ajax and Json with Rails
- errors with Javascript try catch
- how to split a string with ','
- Understanding Javascript scope with "var that = this&qu
- Architecture for CPU intensive tasks with NodeJS & Socke
- How to declare a Map containing certain properties with flow
- 设置'这'在React with Inverse Data Flow中
- Unit-testing multiple use cases with Karma & Mocha.js
- Modify Javascript with C#
- Firefox WebExtension - issue with browser.i18n.getMessage
- 管理 Shorcut,然后单击 Browser with JQuery
- Focus Mobile Browser with Javascript