I made some minor changes to your CSS, which solved the issue you are running into:
On your #scroll
element, you are not defining the positioning, but you are defining the position on your .overlay element with absolute
. This, plus apply the z-index
property with a value of 4 to the .overlay
element causes the overlay to stack on top of the #scroll
element. Since the overlay has a height and width of 100%, you are causing the #scroll
element to become inaccessible, due to the .overlay
element covering it entirely.
#scroll {
height: 100%;
overflow: scroll;
}
.overlay {
height: 100%;
width: 100%;
background-color: #333;
opacity: .4;
position: absolute;
z-index: 4;
left: 0;
top: 0;
}
Basically, if the browser were sheets of paper that were perfectly stacked upon one another, you wouldn't be able to read "access" at the bottom of the stack.
If you are trying to style your scroll bars, I would recommend looking into styling them directly. If not, all you have to do is place a position: relative on the #scroll
and a z-index: 5;
which will solve this issue.
Here is a jsfiddle with the solution: http://jsfiddle.net/dmidify/s4vPV/10/