jQuery-将条目添加到右键单击上下文菜单 [英] Jquery - Add entry to the rightclick contextmenu

查看:72
本文介绍了jQuery-将条目添加到右键单击上下文菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可以禁用菜单

$(document).bind("contextmenu", function(e) {
    return false;
});

您可以显示一个div

you can show a div

$(document).bind("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!
Peter

推荐答案

不是在JavaScript中,否...这可能有一些非常恶意的用途.

Not in JavaScript no...this could have some pretty malicious uses.

您可以创建自己的菜单(如您的<div>示例),但不能将项目添加到本机浏览器上下文菜单中.

You can create your own menu (like your <div> example), but not add items to the native browser context menu.

这篇关于jQuery-将条目添加到右键单击上下文菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆