You can use the pointer-events css property:
.click-thru { pointer-events: none; }
This will make the clicks of the element pass to the element located below it. However, the top element will not receive the click event, so this may not work for you.
You can also try using the global click handler and document.getElementAtPoint to manually fire the event on both elements.
// Example (with jQuery) $(document).click(function(e){ var mouseX = e.pageX, mouseY = e.pageY; if(mouseIsOverElement(mouseX, mouseY, element1)) { $(element1).click(); } if(mouseIsOverElement(mouseX, mouseY, element2)) { $(element2).click(); } }); // Possible implementation of mouseIsOverElement function mouseIsOverElement(x, y, ele) { var result = false; // Hide both $(element1).hide(); $(element2).hide(); // Show the target element $(ele).show(); if(document.getElementAtPoint(x,y)===ele) { result = true; } $(element1).show(); $(element2).show(); return result; }
Na7coldwater
source share