A little dab'll do ya
Code Snippets
Append Site Overlay DIV
$(function() {
var docHeight = $(document).height();
$("body").append("<div id='overlay'></div>");
$("#overlay")
.height(docHeight)
.css({
'opacity' : 0.4,
'position': 'absolute',
'top': 0,
'left': 0,
'background-color': 'black',
'width': '100%',
'z-index': 5000
});
});Overlays entire site with a black tint, disabling all links and bringing into focus anything above it.
I wonder if ‘fixed’ positioning would be better too if the page scrolled…. not sure I guess I should test this better.
position: fixed; will be better in that case.
Tanks..^^
Thanks a lot man! I’ve just discover your snippets repository, and i’ve become enthusiastic about it!
thanks man : -) nice and simple
i was just thinking maybe check if id exists and create some alternative id or abort?
thanks for nice sample code
Perfect! What might be a good way to utilize this, but then have a single element above it? I tried setting that elements z-index above yours, but it still get’s grayed out–any ideas?
@ryan: the ‘aboved’ element should have ‘position:relative;’
perfect! how beautiful it is !
Bon travail Man ;-)