Child z-index solution
HTML
<div id="overlay"></div>
<header>
<div id="below-overlay"></div>
<div id="above-overlay"> <a href="#">Toggle overlay</a>
</div>
</header>
CSS
body {
position: relative;
}
#overlay {
display: none;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: #ccc;
z-index: 2;
}
header {
position: relative;
height: 50px;
}
header #below-overlay,
header #above-overlay{
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
header #below-overlay {
z-index: 1;
background: yellow;
}
header #above-overlay {
line-height: 50px;
z-index: 2;
padding: 0 20px;
}
JavaScript
$(function () {
$('a').click(function () {
$('#overlay').fadeToggle(200);
});
});