3 回答
TA贡献1843条经验 获得超7个赞
preventDefault()
document.addEventListener('contextmenu', event => event.preventDefault());
TA贡献1815条经验 获得超6个赞
别
最新情况:
,它依赖于jQuery ,它使用纯javascript/html
TA贡献1841条经验 获得超3个赞
document.addEventListener("contextmenu", function(e){ e.preventDefault();}, false);
// With jQuery$(document).on({ "contextmenu": function(e) { console.log("ctx menu button:", e.which); // Stop the context menu e.preventDefault(); }, "mousedown": function(e) { console.log("normal mouse down:", e.which); }, "mouseup": function(e) { console.log("normal mouse up:", e.which); }});
添加回答
举报