<?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>App-Matic &#187; message box</title>
	<atom:link href="http://www.app-matic.com/tags/message-box/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.app-matic.com</link>
	<description>Software That Matter!</description>
	<lastBuildDate>Fri, 23 Jul 2010 03:21:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Shake Your Message Box Using jQuery UI</title>
		<link>http://www.app-matic.com/blog/shake-your-message-box-using-jquery-ui/</link>
		<comments>http://www.app-matic.com/blog/shake-your-message-box-using-jquery-ui/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 16:09:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[message box]]></category>

		<guid isPermaLink="false">http://www.app-matic.com/?p=161</guid>
		<description><![CDATA[As a web developer, I shamefully admit that I am pretty late into adopting jQuery in my projects. I've used Prototype, Scriptaculous and ExtJS before but never jQuery. Recently, when I was assigned to a new project, I had a chance to utilize jQuery and a bunch of great plugins. Today I want to share [...]]]></description>
			<content:encoded><![CDATA[<p>As a web developer, I shamefully admit that I am pretty late into adopting jQuery in my projects. I've used Prototype, Scriptaculous and ExtJS before but never jQuery. Recently, when I was assigned to a new project, I had a chance to utilize jQuery and a bunch of great plugins.</p>
<p>Today I want to share with you something that I used in the project—a message box that shake to grab user's attention, usually when error has occurred.</p>
<p>So this is the HTML markup. Notice that I use DIV element with <em>error-message</em> as CSS class, this for the styling which I will add later.</p>
<div class="hl-container">
<div class="hl-main">
<pre><span class="hl-brackets">&lt;</span><span class="hl-reserved">div</span><span class="hl-code"> </span><span class="hl-var">class</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">error-message</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-code">Click here to see me shake.</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">div</span><span class="hl-brackets">&gt;</span></pre>
</div>
</div>
<p><span id="more-161"></span><br />
It's time to add the shake effect. The effect will be seen when the page is loaded but as you can see from the code below, I also add the code to make it shake on click event. </p>
<div class="hl-container">
<div class="hl-main">
<pre><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">shake</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
    $</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">.error-message</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-code">.</span><span class="hl-identifier">effect</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">shake</span><span class="hl-quotes">'</span><span class="hl-code">, </span><span class="hl-brackets">{</span><span class="hl-identifier">times</span><span class="hl-code">:</span><span class="hl-number">3</span><span class="hl-brackets">}</span><span class="hl-code">, </span><span class="hl-number">50</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-brackets">}</span><span class="hl-code">

$</span><span class="hl-brackets">(</span><span class="hl-builtin">document</span><span class="hl-brackets">)</span><span class="hl-code">.</span><span class="hl-identifier">ready</span><span class="hl-brackets">(</span><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
    </span><span class="hl-identifier">shake</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">;

    $</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">.error-message</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-code">.</span><span class="hl-identifier">click</span><span class="hl-brackets">(</span><span class="hl-reserved">function</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
        </span><span class="hl-identifier">shake</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">;
    </span><span class="hl-brackets">}</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-brackets">}</span><span class="hl-brackets">)</span><span class="hl-code">;</span></pre>
</div>
</div>
<p>Since I use this is for showing error message, I want it to be in red and big hence the code below, but you can style it in any way you like. Rounded corners<sup class='footnote'><a href='#fn-161-1' id='fnref-161-1'>1</a></sup> was added to make it more appealing.</p>
<div class="hl-container">
<div class="hl-main">
<pre><span class="hl-identifier">div</span><span class="hl-identifier">.error-message</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
    </span><span class="hl-reserved">font-size:</span><span class="hl-code"> </span><span class="hl-number">140</span><span class="hl-string">%</span><span class="hl-reserved"></span><span class="hl-code">;
    </span><span class="hl-reserved">font-weight:</span><span class="hl-code"> </span><span class="hl-string">bold</span><span class="hl-reserved"></span><span class="hl-code">;
    </span><span class="hl-reserved">margin:</span><span class="hl-code"> </span><span class="hl-number">0</span><span class="hl-code"> </span><span class="hl-string">auto</span><span class="hl-reserved"></span><span class="hl-code">;
    </span><span class="hl-reserved">text-align:</span><span class="hl-code"> </span><span class="hl-string">center</span><span class="hl-reserved"></span><span class="hl-code">;
    </span><span class="hl-reserved">padding:</span><span class="hl-code"> </span><span class="hl-number">0.7</span><span class="hl-string">em</span><span class="hl-reserved"></span><span class="hl-code">;
    -</span><span class="hl-reserved">moz-border-radius:</span><span class="hl-code"> </span><span class="hl-number">8</span><span class="hl-string">px</span><span class="hl-reserved"></span><span class="hl-code">;
    -</span><span class="hl-reserved">webkit-border-radius:</span><span class="hl-code"> </span><span class="hl-number">8</span><span class="hl-string">px</span><span class="hl-reserved"></span><span class="hl-code">;
    </span><span class="hl-reserved">width:</span><span class="hl-code"> </span><span class="hl-number">90</span><span class="hl-string">%</span><span class="hl-reserved"></span><span class="hl-code">;
    </span><span class="hl-reserved">border:</span><span class="hl-string">solid</span><span class="hl-code"> </span><span class="hl-number">1</span><span class="hl-string">px</span><span class="hl-code"> </span><span class="hl-var">#CC0000</span><span class="hl-reserved"></span><span class="hl-code">;
    </span><span class="hl-reserved">background:</span><span class="hl-var">#F7CBCA</span><span class="hl-reserved"></span><span class="hl-code">;
    </span><span class="hl-reserved">color:</span><span class="hl-var">#CC0000</span><span class="hl-reserved"></span><span class="hl-code">;
</span><span class="hl-brackets">}</span></pre>
</div>
</div>
<p>Click here for <a href="http://www.app-matic.com/wp-content/uploads/2009/12/shake.html">demo and full source code</a>.
<div class='footnotes'>
<div class='footnotedivider'></div>
<ol>
<li id='fn-161-1'>Tested in FF, Crome &#038; Safari <span class='footnotereverse'><a href='#fnref-161-1'>&#8617;</a></span></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.app-matic.com/blog/shake-your-message-box-using-jquery-ui/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
