JSFiddle - React, Tailwind, and code Playground
HTML
<div id="box"></div>
CSS
#box {
width: 100px;
height: 150px;
background: coral;
position: absolute;
}
JavaScript
$('#box').hide();
$(document).bind("contextmenu", function(e) {
$("#box").css({left:e.pageX, top:e.pageY});
$('#box').show();
e.preventDefault();
});
$(document).bind("click", function(e) {
$('#box').hide();
});
$('#box').bind("click", function(e) {
$('#box').hide();
});