JSFiddle - React, Tailwind, and code Playground
by Mike_Bozhko
HTML
<div></div>
CSS
body {
width: 500px;
height: 500px;
}
div#context-menu {
width: 100px;
height: 100px;
background-color: red;
position: absolute;
top: 0;
left: 0;
display:none;
}
div#context-menu.active {
display:inherit;
}
JavaScript
$('body').on('contextmenu', function(event) {
event.preventDefault();
$('div').css({
'top': event.pageY,
'left': event.pageX
}).toggle().effect( "slide", "slow" );
});