So, I was going to do an overlay thing for my site, where the element is fixed above the site and placed over everything. But this means that there can be nothing else behind the element.
Here's a JSFiddle reproducing this issue.
You will notice that you cannot select black text, and the JavaScript event does not fire.
Here is the CSS + HTML that I used to create this problem:
HTML
<div id="main-container"> <div id="container-content">You can't highlight me! D:</div> <div id="container-fixed"><div style="margin:90px auto;background:red;width:40px;height:40px;"></div>You cannot highlight the text behind this DIV. It also doesn't fire click events.</div> </div>
main-container : This contains the content.
container-content : this content is behind a fixed div
container-fixed : This DIV overlaps the contents of the container
CSS
#main-container { width: 90%; margin: 5%; position: relative; height: 500px; overflow: auto; } #container-content { width: 100%; height: auto; } #container-fixed { width: 100%; height: 100%; position: absolute; top: 0; left: 0; color: red; }
Am I trying to achieve what I am trying to achieve? Both CSS and JavaScript (jQuery) responses are allowed.
javascript jquery html css
user3117575
source share