开发者

ContextMenu enabling issue

For the body tag I have context开发者_StackOverflow中文版Menu disabled.

<body oncontextmenu="return false">

But in my application one element, which is inside the body, needs the right click enabled. How to enable it for one particular div/element?


Inside the oncontextmenu handler, check if the target element has a particular id, className or some other property.

document.body.oncontextmenu = function (e) {
    if (e.target.id !== 'that-div') { return false }
}

Example: http://jsfiddle.net/eWBUR/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜