Let's assume I have two overlapping divs, and the following jQuery snippet:
$( "#div1" ).click(function() {
console.log('click on div1');
});
$( "#div2" ).mousemove(function() {
console.log('mousemove on div2');
});
As far as I understood, in this case only one div receives events - either the latest defined in the HTML, or with the highest z-index, div2 in my case.
By googling around I found out that events could be propagated to div1 if div2 is styled with pointer-events: none
. This makes div2 completely unresponsive to any mouse events.
But would it be possible to have the events triggered on both divs? At least being able to filter out events (e.g. in the provided example, have mousemoves triggering div2 and clicks div1)?