disabling browser context menu on a raphael paper

天大地大妈咪最大 提交于 2019-12-11 02:03:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!