GMail works on iframe, and the overlay is divnot inside this iframe, so it stays on top of the iframe, therefore, on top of the scrollbar.
Code from GMail
html, body {
height:100%;
margin:0;
overflow:hidden;
width:100%;
}
.cO {
height:100%;
width:100%;
}
.Kj-JD {
background-color:#C3D9FF;
border:1px solid #4E5766;
color:#000000;
outline:0 none;
padding:5px;
position:absolute;
top:0;
width:450px;
z-index:501;
}
.Kj-JD-Jh {
background-color:#808080;
left:0;
position:absolute;
top:0;
z-index:500;
}
HTML example
<body>
<iframe class="cO">...</iframe>
<div class="Kj-JD"></div>
<div class="Kj-JD-Jh" style="opacity: 0.5; width: 1440px; height: 361px;"></div>
</body>
div , jqModal, .