js 自定义右键

document.getElementById("id").oncontextmenu = (function () {
return function (e) { e.preventDefault(); };
})();
document.onmousedown = function () {
if (event.button == 1) { alert("left") }
if (event.button == 2) {
document.getElementById("id").onmouseup = (function () {

return function () {
if (event.button == 2) {
$("#moreUlF-0").toggle();//自定义的右键栏
}
};

}
}

posted @ 2019-08-01 17:45  笑兮兮  阅读(330)  评论(0编辑  收藏  举报