Consider this situation:
You have a scenario where two images are stacked on top of each other. The image with the highest z-index is transparent and handles click events, similar to Google's Map API, while the image below is for visual representation.
Below is a sample pseudo code in HTML/CSS:
div.visual-container {
width: 10px;
height: 10px;
}
div.visual-container:hover {
background-color: #555;
}
div.click-container {
width: 10px;
height: 10px;
}
<div class='lowest'>
<div class='visual-container'></div>
</div>
<div class='highest'>
<div class='click-container'></div>
</div>
When the 'highest' element is clicked, the event is triggered on the 'lowest' element as well.
The main concept:
function onHoverEventForHighest() {
createMouseEvent(lowest_element, 'mouseover', event);
};
This part works fine and transfers the event accordingly, but it does not activate the :hover CSS pseudo-class.
Has anyone successfully implemented something like this before?