Question

I've a canvas in foreground in order to be able to draw above my page.

Since my canvas is in foreground, it catches all events and I can't interact with any elements in the DOM.

For a simple click, I success to catch the event and dispatch it to the element behind the canvas doing:

var _dispatchEvent = function(e) {
  newEvent = new e.constructor(e.type, e);
  this.div.style.display = 'none';
  document.elementFromPoint(e.pageX, e.pageY).dispatchEvent(newEvent);
  this.div.style.display = 'block';
};

*I bound _dispatchEvent with all kind of events*

This work pretty well with links, checkbox, or radio. However it doesn't work for example with a select element because the event 'select' can't be triggered on a canvas element.

Looking for another solution, do you have any idea of how I could draw above the dom (using canvas or something else) and still be able to interact with it ?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top