JSFiddle - React, Tailwind, and code Playground
HTML
<script src="//code.jquery.com/jquery-3.2.1.min.js"></script>
<div class="wrapper">
<br />
<div id="viewer2" class="viewer" style="width:800px; height:300px; position: absolute;"></div>
<canvas id="paper" width="800" height="300" style="border:1px solid #ccc;position: absolute;"></canvas>
<br />
</div>
JavaScript
$('.viewer').bind('contextmenu', function(e) {
return false;
});
$('#paper').bind('contextmenu', function(e) {
return false;
});
document.getElementById('paper').onmousedown = FuncOnClick;
function FuncOnClick(event) {
console.log(event.which);
switch (event.which) {
case 1:
document.getElementById("paper").style.pointerEvents = "none";
setTimeout(function(){
document.getElementById("paper").style.pointerEvents = "all";
}, 500)
alert('Left');
break;
case 3:
document.getElementById("paper").style.pointerEvents = "all";
alert('Right ');
break;
}
}