Sorry, I can't post the full code, I'm working on proprietary things. Basically, I have a problem when a DIV that has a z-index of 6 is blocked by an overlay DIV that has a z-index of 5. Is there any script that would do this? I am trying to understand why this is happening. It just doesn't make any sense. Anything related to embedding DIVs or CSS position maybe?
I apologize for the uncertainty. I tried to recreate in JSFiddle, but it works as expected, unfortunately. Only the actual code is inconvenient.
Composition:
<div id="window"> <div id="wall"> <div class="box" /><div class="box" /> .... many boxes </div> </div> <div id="overlay" />
CSS
#window { position: relative; width: 960px; height: 700px; overflow: hidden; background: #666; } #wall { position: relative; width: 1640px; height: 1600px; -webkit-perspective: 2000; } #overlay { position: absolute; z-index: 5; background: #000; } .box { left: 0px; top: 0px; position: absolute; width: 228px; height: 228px; color: #fff; font-family: Helvetica, Arial, sans-serif; font-weight: bold; font-size: 0.8em; -webkit-transform-style: preserve-3d; z-index: 4; cursor: pointer; }
Overlay sizes are set via jQuery on a specific event:
$('<div id="overlay"></div>').css({ 'left': $('#window').position().left + 'px', 'top': $('#window').position().top + 'px', 'width': $('#window').width() + 'px', 'height': $('#window').height() + 'px', 'opacity': 0.8 }).appendTo('body');
Despite the fact that one of the boxes has a z-index of 6, and the overlay is 5, the overlay is still above the specified field.
The overlay is supposed to go through the window, but let one of its drawers go through.
Why the hell does this JSFiddle work, but my actual code doesn't ?! http://jsfiddle.net/csaltyj/2gzTc/