JSFiddle - React, Tailwind, and code Playground

by loktar

HTML

<canvas id="canvas"></canvas>
<canvas id="canvas2"></canvas>

CSS

canvas{position:absolute;}
#canvas{
 background:#000;
 pointer-events:none;   
}

JavaScript

var canvas = document.getElementById("canvas"),
    canvas2 = document.getElementById("canvas2");


// Nothing will happen because its ignoring clicks. Comment out the style and it will log canvas 1 to the console.
canvas.addEventListener("click",function(){console.log("canvas 1")});

// Canvas 2 will be logged to the console since its underneat canvas 1
canvas2.addEventListener("click",function(){console.log("canvas 2")});