hi,
ive just noticed that when i click the 'Log Out' button top right on this website, the whole page is 'grayed out'. ive noticed this on a few website, how can i do the same on my site?
thanks.
| SitePoint Sponsor |



hi,
ive just noticed that when i click the 'Log Out' button top right on this website, the whole page is 'grayed out'. ive noticed this on a few website, how can i do the same on my site?
thanks.


Hi,
Just look through the source and you will find
For ie only its done something like this.
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <style> html{background:#fffcc} div{background:blue;width:300px;height:300px;color:#fff;} </style> <script type="text/javascript"> <!-- function log_out() { ht = document.getElementsByTagName("html"); ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)"; if (confirm('Are you sure you want to log out?')) { return true; } else { ht[0].style.filter = ""; return false; } } //--> </script> </head> <body> <p><a onclick="log_out();return false;" href="#">Cick</a></p> <div><p>testing</p></div> </body> </html>
You set the proprietary IE grayscale filter on the html through javascript when logout is clicked.
www.pmob.co.uk CSS FAQ 3 col demo Read My CSS Articles
Ultimate CSS Reference
Check out SitePoint's latest JavaScript challenge

Just goes to show how much better IE is than other browsers!


I'm just kidding. I loathe IE.
Although that greyscale thing is quite cool.



Well you could do a similar thing for other browsers using opacity instead.Originally Posted by johnny
e.g.
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <style> html{background:#fffcc;} div{background:blue;width:300px;height:300px;color:#fff;} </style> <script type="text/javascript"> <!-- function log_out() { ht = document.getElementsByTagName("html"); bdy = document.getElementsByTagName("body"); ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)"; bdy[0].style.opacity = 0.4; if (confirm('Are you sure you want to log out?')) { return true; } else { ht[0].style.filter = ""; bdy[0].style.opacity = ""; return false; } } //--> </script> </head> <body> <p><a onclick="log_out();return false;" href="#">Cick</a></p> <div><p>testing</p></div> </body> </html>
www.pmob.co.uk CSS FAQ 3 col demo Read My CSS Articles
Ultimate CSS Reference
Check out SitePoint's latest JavaScript challenge




thanks guys,
IE filters rock!!!!! (only joking)
This is often done (cross browser) using the ThickBox JS.
another technique is to use make a display:none set to position:absolute; top:0px; left:0px; width:100%; z-index:10000; with a transparent .png as it's background - means you have to add a DX filter so IE will render the png transparancy, but it works. Just change it to display:block and set the height to the current document height in javascript, and yer good to go.
Oh, and what is with this lightbox/thickbox nonsense anyhow? Just chewing bandwidth 'because' or something? 12k (thickbox) to 18k (lightbox) of javascript just to have a loading screen atop something that should only take MAYBE 1k of javascript and ten lines of CSS without it seems... I dunno... wasteful at best? Agonizingly slow at worst?


I was waiting for you to say that, deathshadow.
Save the Internet - Use Opera | May my mother rest in peace: 1943-2009
Dan Schulz - Design Team Advisor | Follow me on Twitter
SitePoint References: HTML CSS JavaScript | Become A Guru
WordPress SEO Checklist | What WordPress Plugins Do You Use?
Web Standards Curriculum | Image Free Equal Height Columns

I mimicked it and I used about 10 lines of javascript plus 30 or so of CSS and it works in pretty much the same way (though it's not as slick and pretty). The thing that makes lightbox so big (sic) is the fading, sliding effects and there are over 100 lines devoted to creating HTML elements. But I can see why people use it. You just chuck it in a directory, give your links a rel="lightbox" and that's it - couldn't be easier.
Bookmarks