JSFiddle - React, Tailwind, and code Playground
HTML
<h1>iframe 1</h1>
right-click for context menu
<div id="box">
CONTEXT MENU
</div>
CSS
body { background-color: green; }
#box {
position: absolute;
border: 1px solid;
background-color: white;
width: 200px;
height: 100px;
z-index: 99;
}
JavaScript
$(function(){
$('#box').hide();
$(document).bind("contextmenu", function(e) {
e.preventDefault();
$("#box").css({left:e.pageX, top:e.pageY});
$('#box').show();
});
$(document).bind("mousedown", function(e) {
$('#box').hide();
});
$('#box').bind("mousedown", function(e) {
$('#box').hide();
});
});