问题
I have a Raphael paper defined as R1 = Raphael(0,0, 800, 600);
I want to disable context menu on this paper so that I can catch mouse right click event. I don't have it like Raphael("someDiv", 800, 600)
to disable the oncontextmenu property for the div.
How should I do it in this case?
回答1:
obj.node.oncontextmenu = function(){ return false; }
http://jsfiddle.net/z6tyH/
回答2:
Try attaching this:
/*[Your Element Here]*/.oncontextmenu = function(event){event.preventDefault();}
Catching oncontextmenu
instead of right click.
Also note that the browser's preferences may not allow you to disable contextual menus.
来源:https://stackoverflow.com/questions/16257535/disabling-browser-context-menu-on-a-raphael-paper