Jquery - Add entry to the rightclick contextmenu
you can disable the menu
$(document).bind("contextmenu", function(e) {
return false;
});
you can show a div
$(document).b开发者_高级运维ind("contextmenu", function(e) {
$('#menu').css({
top: e.pageY+'px',
left: e.pageX+'px'
}).show();
return false;
});
but is it possible only to add an entry to the rightclick contextmenu?
Thanks in advance!
PeterNot in JavaScript no...this could have some pretty malicious uses.
You can create your own menu (like your <div>
example), but not add items to the native browser context menu.
Thanks to HTML5 this is possible now: http://davidwalsh.name/demo/html5-context-menu.php
There is a nice jquery plugin, called "contextMenu" :)
http://medialize.github.io/jQuery-contextMenu/demo.html
I use it and its very easy to customize.
精彩评论