<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tech.It.2.Me-&#62;{By.Anton.Perez} &#187; JavaScript</title>
	<atom:link href="http://antonperez.com/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://antonperez.com</link>
	<description>Technical satisfaction guaranteed...</description>
	<lastBuildDate>Fri, 10 Feb 2012 02:06:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Web 2.0: Gray out the screen</title>
		<link>http://antonperez.com/2007/12/18/web-20-grey-out-the-screen/</link>
		<comments>http://antonperez.com/2007/12/18/web-20-grey-out-the-screen/#comments</comments>
		<pubDate>Tue, 18 Dec 2007 21:05:49 +0000</pubDate>
		<dc:creator>anton</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://antonperez.com/2007/12/14/web-20-grey-out-the-screen/</guid>
		<description><![CDATA[This snippet grays out the screen and allows you to create a modal environment. A gray out is useful for creating a DHTML dialog box, or showing off a picture or video. While a gray out is active, most interactive elements on the page (links, etc.) are inactive &#8211; you&#8217;ve probably seen this on the [...]]]></description>
			<content:encoded><![CDATA[<p>This snippet <q>grays</q> out the screen and allows you to create a <q><abbr>modal</abbr></q> environment. A gray out is useful for creating a DHTML dialog box, or showing off a picture or video. While a gray out is active, most interactive elements on the page (links, etc.) are inactive &#8211; you&#8217;ve probably seen this on the new My Yahoo! page.</p>
<pre>function grayOut(vis, options) {
  // Pass true to gray out screen, false to ungray
  // options are optional.  This is a JSON object with the following (optional) properties
  // opacity:0-100         // Lower number = less grayout higher = more of a blackout
  // zindex: #             // HTML elements with a higher zindex appear on top of the gray out
  // bgcolor: (#xxxxxx)    // Standard RGB Hex color code
  // grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
  // Because options is JSON opacity/zindex/bgcolor are all optional and can appear
  // in any order.  Pass only the properties you need to set.
  var options = options || {};
  var zindex = options.zindex || 50;
  var opacity = options.opacity || 70;
  var opaque = (opacity / 100);
  var bgcolor = options.bgcolor || '#000000';
  var dark=document.getElementById('darkenScreenObject');
  if (!dark) {
    // The dark layer doesn't exist, it's never been created.  So we'll
    // create it here and apply some basic styles.
    // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
    var tbody = document.getElementsByTagName("body")[0];
    var tnode = document.createElement('div');           // Create the layer.
        tnode.style.position='absolute';                 // Position absolutely
        tnode.style.top='0px';                           // In the top
        tnode.style.left='0px';                          // Left corner of the page
        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars
        tnode.style.display='none';                      // Start out Hidden
        tnode.id='darkenScreenObject';                   // Name it so we can find it later
    tbody.appendChild(tnode);                            // Add it to the web page
    dark=document.getElementById('darkenScreenObject');  // Get the object.
  }
  if (vis) {
    // Calculate the page width and height
    if( document.body &amp;&amp; ( document.body.scrollWidth || document.body.scrollHeight ) ) {
        var pageWidth = document.body.scrollWidth+'px';
        var pageHeight = document.body.scrollHeight+'px';
    } else if( document.body.offsetWidth ) {
      var pageWidth = document.body.offsetWidth+'px';
      var pageHeight = document.body.offsetHeight+'px';
    } else {
       var pageWidth='100%';
       var pageHeight='100%';
    }
    //set the shader to cover the entire page and make it visible.
    dark.style.opacity=opaque;
    dark.style.MozOpacity=opaque;
    dark.style.filter='alpha(opacity='+opacity+')';
    dark.style.zIndex=zindex;
    dark.style.backgroundColor=bgcolor;
    dark.style.width= pageWidth;
    dark.style.height= pageHeight;
    dark.style.display='block';
  } else {
     dark.style.display='none';
  }
}</pre>
<p>Thanks to <a href="http://www.hunlock.com/">Peter Hunlock</a> for sharing this.</p>
]]></content:encoded>
			<wfw:commentRss>http://antonperez.com/2007/12/18/web-20-grey-out-the-screen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

