<?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>Ed Spencer &#187; mask</title>
	<atom:link href="http://edspencer.net/tag/mask/feed" rel="self" type="application/rss+xml" />
	<link>http://edspencer.net</link>
	<description>A Sencha Architect</description>
	<lastBuildDate>Sat, 11 Feb 2012 09:20:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Adding a loading mask to your ExtJS application</title>
		<link>http://edspencer.net/2009/02/adding-loading-mask-to-your-extjs.html</link>
		<comments>http://edspencer.net/2009/02/adding-loading-mask-to-your-extjs.html#comments</comments>
		<pubDate>Sun, 01 Feb 2009 15:55:00 +0000</pubDate>
		<dc:creator>Ed Spencer</dc:creator>
				<category><![CDATA[Examples]]></category>
		<category><![CDATA[extjs]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[loading]]></category>
		<category><![CDATA[mask]]></category>

		<guid isPermaLink="false">http://192.168.2.15/Projects/wordpress/?p=24</guid>
		<description><![CDATA[<p>Adding a loading mask like the one on the <a href="http://extjs.com/deploy/dev/docs/">ExtJS API application</a> is a nice way of showing the user that something is happening while their browser downloads the source code.  It&#8217;s also extremely easy to do.</p>
<p>First, place the following HTML above all of your javascript include tags, ideally just after the &lt;body&gt; tag:</p>
<pre class="brush: xml;">
&lt;div id=&quot;loading-mask&quot;&gt;&lt;/div&gt;
&lt;div id=&quot;loading&quot;&gt;
  &lt;div class=&quot;loading-indicator&quot;&gt;
    Loading...
  &lt;/div&gt;
&lt;/div&gt;
</pre>
<p>If you are currently including javascript files inside the &lt;head&gt;, don&#8217;t &#8211; <a href="http://developer.yahoo.com/performance/rules.html#js_bottom">put them at the bottom</a>.</p>
<p>With a bit of CSS (see below), this provides a white mask over all underlying content, and a loading message.  When everything has loaded, remove the mask like this:</p>
<pre class="brush: jscript;">
Ext.onReady(function() {
  setTimeout(function(){
    Ext.get('loading').remove();
    Ext.get('loading-mask').fadeOut({remove:true});
  }, 250);
});
</pre>
<p>The above simply fades out the HTML elements to reveal the now ready page.  The setTimeout call gives your app a little time to render, which is useful if you&#8217;re doing something like pulling external content down from the server.</p>
<p>Finally, here&#8217;s the CSS I use to style up the loading mask.  You&#8217;ll need to <a href="http://extjs.com/deploy/dev/docs/resources/extanim32.gif">download a loading image</a> and stick it in the appropriate directory.</p>
<pre class="brush: css;">
#loading-mask {
  position: absolute;
  left:     0;
  top:      0;
  width:    100%;
  height:   100%;
  z-index:  20000;
  background-color: white;
}

#loading {
  position: absolute;
  left:     50%;
  top:      50%;
  padding:  2px;
  z-index:  20001;
  height:   auto;
  margin:   -35px 0 0 -30px;
}

#loading .loading-indicator {
  background: url(../images/loading.gif) no-repeat;
  color:      #555;
  font:       bold 13px tahoma,arial,helvetica;
  padding:    8px 42px;
  margin:     0;
  text-align: center;
  height:     auto;
}
</pre>
]]></description>
			<content:encoded><![CDATA[<p>Adding a loading mask like the one on the <a href="http://extjs.com/deploy/dev/docs/">ExtJS API application</a> is a nice way of showing the user that something is happening while their browser downloads the source code.  It&#8217;s also extremely easy to do.</p>
<p>First, place the following HTML above all of your javascript include tags, ideally just after the &lt;body&gt; tag:</p>
<pre class="brush: xml;">
&lt;div id=&quot;loading-mask&quot;&gt;&lt;/div&gt;
&lt;div id=&quot;loading&quot;&gt;
  &lt;div class=&quot;loading-indicator&quot;&gt;
    Loading...
  &lt;/div&gt;
&lt;/div&gt;
</pre>
<p>If you are currently including javascript files inside the &lt;head&gt;, don&#8217;t &#8211; <a href="http://developer.yahoo.com/performance/rules.html#js_bottom">put them at the bottom</a>.</p>
<p>With a bit of CSS (see below), this provides a white mask over all underlying content, and a loading message.  When everything has loaded, remove the mask like this:</p>
<pre class="brush: jscript;">
Ext.onReady(function() {
  setTimeout(function(){
    Ext.get('loading').remove();
    Ext.get('loading-mask').fadeOut({remove:true});
  }, 250);
});
</pre>
<p>The above simply fades out the HTML elements to reveal the now ready page.  The setTimeout call gives your app a little time to render, which is useful if you&#8217;re doing something like pulling external content down from the server.</p>
<p>Finally, here&#8217;s the CSS I use to style up the loading mask.  You&#8217;ll need to <a href="http://extjs.com/deploy/dev/docs/resources/extanim32.gif">download a loading image</a> and stick it in the appropriate directory.</p>
<pre class="brush: css;">
#loading-mask {
  position: absolute;
  left:     0;
  top:      0;
  width:    100%;
  height:   100%;
  z-index:  20000;
  background-color: white;
}

#loading {
  position: absolute;
  left:     50%;
  top:      50%;
  padding:  2px;
  z-index:  20001;
  height:   auto;
  margin:   -35px 0 0 -30px;
}

#loading .loading-indicator {
  background: url(../images/loading.gif) no-repeat;
  color:      #555;
  font:       bold 13px tahoma,arial,helvetica;
  padding:    8px 42px;
  margin:     0;
  text-align: center;
  height:     auto;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://edspencer.net/2009/02/adding-loading-mask-to-your-extjs.html/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

