[英]Right click context menu for <div> like anchor (open new tab etc..)
Due to usability reasons I shouldn't use a div wrapped with anchor tag.由于可用性原因,我不应该使用带有锚标记的 div。
So I created a card shaped new div.所以我创建了一个卡片形状的新 div。 And direct user to destination with jquery.
并使用 jquery 将用户定向到目的地。
My only problem is when I right click to this div, it doesn't show a context menu like anchor tag does(open in a new tab ext..).我唯一的问题是当我右键单击此 div 时,它不会显示像锚标记那样的上下文菜单(在新选项卡中打开 ..)。
I'm wondering if is there a way to add a context menu to a div that looks like it is an anchor?我想知道是否有办法将上下文菜单添加到看起来像锚点的 div?
did you try to add functionality like given?您是否尝试添加给定的功能?
document.addEventListener( "contextmenu", function(e) {
// functionality to perform
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.