I’ve got a div with an image in it that is covering a bunch of other divs. Something like this:
<div style='width:100%;height:100%'><img src='someImage.png'></div>
<div id='covered'>I'm covered by the div above me, but still visible</div>
I want to define a jQuery event handler like this:
$('#covered').live('mouseover',function(){ do stuff });
But the mouseover event isn’t working because of the div that is covering it. Is there any way to get this to work?
(Notes… the div covering it does have a higher z-index because it needs to always be layered on top. And I’m using “live” because #covered get generated dynamically.)
If the overlay is the same dimensions as the
#coveredelement then you can just bind to themouseoverevent for the overlay:Update
If the overlay is covering the whole page then you can check the
mousemoveevent to see if the cursor has been moved over the#coveredelement:Here is a demo: http://jsfiddle.net/WjRNv/1/ (watch your console to see the log when you mouse-over the
#coveredelement)