<?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>Programming Blog &#187; span class</title>
	<atom:link href="http://www.neurosoftware.ro/programming-blog/tag/span-class/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.neurosoftware.ro/programming-blog</link>
	<description>Web development , php , ajax , symfony, framework, zend</description>
	<lastBuildDate>Thu, 18 Aug 2011 08:11:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Drawing Realistic iPad2 in Photoshop</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/drawing-realistic-ipad2-in-photoshop/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/drawing-realistic-ipad2-in-photoshop/#comments</comments>
		<pubDate>Tue, 12 Jul 2011 18:35:52 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[web resources]]></category>
		<category><![CDATA[emboss]]></category>
		<category><![CDATA[home button]]></category>
		<category><![CDATA[inner glow]]></category>
		<category><![CDATA[inner shadow]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[rectangle tool]]></category>
		<category><![CDATA[screen content]]></category>
		<category><![CDATA[span class]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/drawing-realistic-ipad2-in-photoshop/</guid>
		<description><![CDATA[iPad 2! Many love it, many want it, but not many can draw it. Surprisingly, drawing it and its smart cover is not hard at all! In this tutorial I&#8217;m gonna show you how to create a complete iPad 2 with its smart cover, just exactly like the result below: We will use lots of [...]]]></description>
			<content:encoded><![CDATA[<p>iPad 2! Many love it, many want it, but not many can draw it. Surprisingly, drawing it and its smart cover is not hard at all! In this tutorial I&#8217;m gonna show you how to create a complete iPad 2 with its smart cover, just exactly like the result below:</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/ipad-2-with-smart-cover.jpg" alt="ipad 2 with smart cover Drawing Realistic iPad2 in Photoshop" width="500" height="525" /></p>
<p>We will use lots of layer styles and vector drawing, and may be some passion to complete this sleek product. Let&#8217;s get started!</p>
<p><span></span></p>
<h4>Step 1: iPad Basic Shape</h4>
<p>Start by creating a new file with size 1500&#215;800 px. Activate rounded rectangle tool. Set its mode to shape with radius 15 px and color: #f5f5f5.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-01.jpg" width="362" height="524" alt="tutorial ipad2 01 Drawing Realistic iPad2 in Photoshop" /></p>
<p>Add Layer Style <strong>Inner Glow</strong> and <strong>Stroke</strong>.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-02.jpg" width="600" height="464" alt="tutorial ipad2 02 Drawing Realistic iPad2 in Photoshop" /></p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-03.jpg" width="600" height="464" alt="tutorial ipad2 03 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 2: Screen</h4>
<p>Draw a rectangle inside the iPad.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-04.jpg" width="374" height="466" alt="tutorial ipad2 04 Drawing Realistic iPad2 in Photoshop" /></p>
<p>Add Layer Style <strong>Stroke</strong>.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-05.jpg" width="600" height="464" alt="tutorial ipad2 05 Drawing Realistic iPad2 in Photoshop" /></p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-06.jpg" width="357" height="461" alt="tutorial ipad2 06 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 3</h4>
<p>Let&#8217;s create a simple image for the screen content. Create new layer and make sure it is on top of the screen layer. Paint some colors using a soft brush. Convert layer to Clipping mask by pressing <span>Ctrl</span>/<span>Cmd</span> + <span>Alt</span> + <span>G</span>. Everything you paint is now inside the screen.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-07.jpg" width="575" height="454" alt="tutorial ipad2 07 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 4: Home Button</h4>
<p>Draw an ellipse on lower part of the iPad. Set its Fill to 0%.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-08.jpg" width="351" height="472" alt="tutorial ipad2 08 Drawing Realistic iPad2 in Photoshop" /></p>
<p>Add Layer Style <strong>Inner Shadow,</strong> <strong>Bevel and Emboss</strong>, and <strong>Gradient Overlay</strong>.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-09.jpg" width="600" height="464" alt="tutorial ipad2 09 Drawing Realistic iPad2 in Photoshop" /></p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-10.jpg" width="600" height="464" alt="tutorial ipad2 10 Drawing Realistic iPad2 in Photoshop" /></p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-11.jpg" width="600" height="464" alt="tutorial ipad2 11 Drawing Realistic iPad2 in Photoshop" /></p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-12.jpg" width="350" height="454" alt="tutorial ipad2 12 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 5</h4>
<p>In the center of the button, draw a rounded rectangle. Set its Fill to 0%. Add Layer <strong>Style Stroke</strong>.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-13.jpg" width="547" height="428" alt="tutorial ipad2 13 Drawing Realistic iPad2 in Photoshop" /></p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-14.jpg" width="600" height="464" alt="tutorial ipad2 14 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 6: Camera</h4>
<p>Draw a small black on top part of the iPad for its camera.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-15.jpg" width="546" height="165" alt="tutorial ipad2 15 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 7: Dock</h4>
<p>Draw a rectangle covering on lower part of the screen. Set its color to #b1a9a9. Add Layer Style &lt;span class=&quot;key&quot;&gt;.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-16.jpg" width="551" height="216" alt="tutorial ipad2 16 Drawing Realistic iPad2 in Photoshop" /></p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-17.jpg" width="600" height="464" alt="tutorial ipad2 17 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 8</h4>
<p>Hit <span>Ctrl</span>/<span>Cmd</span> + <span>T</span> to perform transformation. Right click and choose Perspective.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-18.jpg" width="600" height="432" alt="tutorial ipad2 18 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 9</h4>
<p>Pull top corner inward until we get a dock shape.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-19.jpg" width="558" height="180" alt="tutorial ipad2 19 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 10</h4>
<p>Draw white shape as seen below. Hit <span>Ctrl</span>/<span>Cmd</span> + <span>Alt</span> + <span>G</span> to convert it to Clipping Mask. Reduce its opacity to 50%.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-20.jpg" width="525" height="387" alt="tutorial ipad2 20 Drawing Realistic iPad2 in Photoshop" /></p>
<p>This shape will become a reflection on the dock.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-21.jpg" width="559" height="197" alt="tutorial ipad2 21 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 11</h4>
<p>Grab a nice iPhone icons set, <a href="http://marcelomarfil.deviantart.com/art/Aquaticus-90760669">Aquaticus</a> from <a href="http://marcelomarfil.deviantart.com/">marcelomarfil</a>. Place four of them on the screen.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-22.jpg" width="527" height="263" alt="tutorial ipad2 22 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 12</h4>
<p>Place the icons on a group named <em>icons</em>. Select all icon layers by clicking on the first icon then <span>Shift</span> + click the last icon. Activate move tool. From the option bar click icon <strong>Distribute Horizontal Center</strong> and <strong>Align Vertical Center</strong>. You will have a nice alignment and distributed icons on the screen.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-23.jpg" width="565" height="775" alt="tutorial ipad2 23 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 13</h4>
<p>Repeat previous step to add more icons on screen and on dock.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-24.jpg" width="521" height="611" alt="tutorial ipad2 24 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 14</h4>
<p>Select icon layers on dock. Hit <span>Ctrl</span>/<span>Cmd</span> + <span>E</span> to merge them into one layer. Hit <span>Ctrl</span>/<span>Cmd</span> + <span>T</span> to perform transformation. Right click and choose <strong>Flip Vertical</strong>.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-25.jpg" width="567" height="408" alt="tutorial ipad2 25 Drawing Realistic iPad2 in Photoshop" /></p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-26.jpg" width="523" height="215" alt="tutorial ipad2 26 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 15</h4>
<p>Add layer mask. Draw linear gradient from white to black until the reflection fades.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-27.jpg" width="522" height="309" alt="tutorial ipad2 27 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 16: Screen Reflection</h4>
<p>Use lasso polygon tool to create a triangular selection on top right corner of the screen. Fill selection with white.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-28.jpg" width="563" height="562" alt="tutorial ipad2 28 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 17</h4>
<p>Add layer mask. Draw linear gradient from white to black until the reflection on the screen fades away. Put the reflection layer into a group and name it <em>Screen Reflection</em>.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-29.jpg" width="584" height="433" alt="tutorial ipad2 29 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 18</h4>
<p><span>Ctrl</span>/<span>Cmd</span> + click iPad layer to create a selection based on its shape. Add layer mask onto the group. This way, the screen reflection is inside the screen.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-30.jpg" width="487" height="345" alt="tutorial ipad2 30 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 19: Smart Cover</h4>
<p>Draw following shape. Use #6ebced for its color.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-31.jpg" width="370" height="481" alt="tutorial ipad2 31 Drawing Realistic iPad2 in Photoshop" /></p>
<p>Add Layer Styles <strong>Gradient Overlay</strong>.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-32.jpg" width="600" height="464" alt="tutorial ipad2 32 Drawing Realistic iPad2 in Photoshop" /></p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-33.jpg" width="372" height="481" alt="tutorial ipad2 33 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 20</h4>
<p>Above smart cover draw a rounded rectangle shape and set its Fill to 0%.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-34.jpg" width="377" height="488" alt="tutorial ipad2 34 Drawing Realistic iPad2 in Photoshop" /></p>
<p>Add <strong>Bevel and Emboss</strong>.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-35.jpg" width="600" height="464" alt="tutorial ipad2 35 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 21</h4>
<p>Duplicate the shape.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-36.jpg" width="416" height="530" alt="tutorial ipad2 36 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 22</h4>
<p>Hit <span>Ctrl</span>/<span>Cmd</span> + <span>T</span> to perform transformation. Right click and choose Perspective. Pull top right corner until the shape match  smart cover perspective.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-37.jpg" width="440" height="486" alt="tutorial ipad2 37 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 23</h4>
<p>Draw a rounded rectangle with color: #82858a. Perform perspective transformation again until we have outer side of the smart cover.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-38.jpg" width="440" height="508" alt="tutorial ipad2 38 Drawing Realistic iPad2 in Photoshop" /></p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-39.jpg" width="403" height="499" alt="tutorial ipad2 39 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 24</h4>
<p>Add Layer Styles <strong>Bevel and Emboss</strong> and <strong>Gradient Overlay</strong>.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-40.jpg" width="600" height="464" alt="tutorial ipad2 40 Drawing Realistic iPad2 in Photoshop" /></p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-41.jpg" width="600" height="464" alt="tutorial ipad2 41 Drawing Realistic iPad2 in Photoshop" /></p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-42.jpg" width="358" height="488" alt="tutorial ipad2 42 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 26</h4>
<p>Draw another rounded rectangle and place it inside shape we have just created.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-43.jpg" width="392" height="492" alt="tutorial ipad2 43 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 27</h4>
<p>Add Layer Style <strong>Bevel and Emboss</strong> and set its Fill to 0%.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-44.jpg" width="600" height="464" alt="tutorial ipad2 44 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 28</h4>
<p>Hit <span>Ctrl</span>/<span>Cmd</span> + <span>Alt</span> + <span>G</span> to convert shape into clipping mask and place the effect inside the cover.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-45.jpg" width="407" height="489" alt="tutorial ipad2 45 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 29: Hinges</h4>
<p>Draw a rectangle on left side of the cover. Set its color to #6ebced.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-46.jpg" width="372" height="495" alt="tutorial ipad2 46 Drawing Realistic iPad2 in Photoshop" /></p>
<p>Add <strong>Gradient Overlay</strong>.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-47.jpg" width="600" height="464" alt="tutorial ipad2 47 Drawing Realistic iPad2 in Photoshop" /></p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-48.jpg" width="379" height="488" alt="tutorial ipad2 48 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 30</h4>
<p>Draw a smaller rectangle behind previous shape with color: #e6e6e6. </p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-49.jpg" width="364" height="520" alt="tutorial ipad2 49 Drawing Realistic iPad2 in Photoshop" /></p>
<p>Add Layer Style <strong>Gradient Overlay</strong> to add three dimensional appearances onto the shape.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-50.jpg" width="600" height="464" alt="tutorial ipad2 50 Drawing Realistic iPad2 in Photoshop" /></p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-51.jpg" width="383" height="488" alt="tutorial ipad2 51 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 31: Shadow</h4>
<p>Hold <span>Ctrl</span>/<span>Cmd</span> then click the iPad basic shape layer to create a selection based on its shape. Create new layer and place it under smart cover. Paint a soft shadow on the screen surface using big soft brush.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-52.jpg" width="393" height="521" alt="tutorial ipad2 52 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 32</h4>
<p>Do not remove the selection. Next, draw a soft shadow with low opacity brush on lower side of the iPad. This will be a soft cast shadow from the floor.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-53.jpg" width="409" height="544" alt="tutorial ipad2 53 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 33</h4>
<p>Create new layer and place it under all layers. Paint darker shadow under the iPad using a big soft brush. Reduce its Opacity to 50%.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-54.jpg" width="432" height="338" alt="tutorial ipad2 54 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 34</h4>
<p>Draw bigger and softer shadow. Reduce its opacity to 5%.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-55.jpg" width="594" height="449" alt="tutorial ipad2 55 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 35</h4>
<p>Now, set your brush to smaller size but keep its hardness to 0% to maintain its softness. Draw darker shadow right under the iPad. Set its opacity to 50%.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-56.jpg" width="406" height="244" alt="tutorial ipad2 56 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 36</h4>
<p>Zoom in to see smart cover closer. Draw a dark shadow right under the smart cover.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-57.jpg" width="564" height="317" alt="tutorial ipad2 57 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 37</h4>
<p>Draw shadow on the floor behind smart cover.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-58.jpg" width="576" height="217" alt="tutorial ipad2 58 Drawing Realistic iPad2 in Photoshop" /></p>
<p>This is what the shadow looks like if we hide the smart cover.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/tutorial-ipad2-59.jpg" width="564" height="206" alt="tutorial ipad2 59 Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Step 38: Final Result</h4>
<p>This is the result of our tutorial. I hope you learn new technique and have some fun following this tutorial. Thank you for reading. If you have any questions feel free to ask.</p>
<p><img src="http://media02.hongkiat.com/ipad2-photoshop-tutorial/final.jpg" width="600" height="758" alt="final Drawing Realistic iPad2 in Photoshop" /></p>
<h4>Download PSD</h4>
<p>Can&#8217;t achieve certain step? Here is the result&#8217;s PSD file for you to test and play with.</p>
<ul>
<li><a rel="external" href="http://media02.hongkiat.com/ipad2-photoshop-tutorial/ipad2-tutorial.psd">iPad 2 Tutorial PSD File</a></li>
</ul>
<p><img src="http://feeds.feedburner.com/~r/24thfloor/~4/GYB5R82soSw" height="1" width="1" /><br />
<a href="http://feedproxy.google.com/24thfloor">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/drawing-realistic-ipad2-in-photoshop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Duplicate DeSandro&#8217;s CSS Effect</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/duplicate-desandros-css-effect-2/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/duplicate-desandros-css-effect-2/#comments</comments>
		<pubDate>Fri, 17 Jun 2011 09:28:51 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[web resources]]></category>
		<category><![CDATA[brilliant idea]]></category>
		<category><![CDATA[css effects]]></category>
		<category><![CDATA[div id]]></category>
		<category><![CDATA[helvetica neue]]></category>
		<category><![CDATA[j walsh]]></category>
		<category><![CDATA[sans serif]]></category>
		<category><![CDATA[span class]]></category>
		<category><![CDATA[span elements]]></category>
		<category><![CDATA[text shadow]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/duplicate-desandros-css-effect-2/</guid>
		<description><![CDATA[I recently stumbled upon David DeSandro&#8217;s website when I saw a tweet stating that someone had stolen/hotlinked his website design and code, and he decided to do the only logical thing to retaliate:  use some simple JavaScript goodness to inject unicorns into their page.  A brilliant idea, if I may say so myself (and I [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://davidwalsh.name/dw-content/css-desandro.php"></a></p>
<p>I recently stumbled upon <a href="http://desandro.com/">David DeSandro&#8217;s website</a> when I saw a tweet stating that someone had stolen/hotlinked his website design and code, and he decided to do the only logical thing to retaliate:  use some simple JavaScript goodness to inject unicorns into their page.  A brilliant idea, if I may say so myself <em>(and I may)</em>.  David&#8217;s design is simplistic but features a few classy CSS effects, one of the most impressive being the footer &#8220;made this&#8221; animation.  Let me show you how David accomplished this effect.</p>
<div><a href="http://davidwalsh.name/dw-content/css-desandro.php">View Demo</a></p>
<div></div>
</div>
<h2>The HTML</h2>
<p>The system will consist of a wrapper (though it&#8217;s not necessarily needed), an link, and a series of SPAN tags:</p>
<pre>
&lt;div id="animationWrapper"&gt;
	&lt;a href="/"&gt;
		&lt;span class="span1"&gt;David&lt;/span&gt;
		&lt;span class="span2"&gt;J. Walsh&lt;/span&gt;
		&lt;span class="span3"&gt;Arsenal&lt;/span&gt;
		&lt;span class="span4"&gt;Legend&lt;/span&gt;
	&lt;/a&gt;
&lt;/div&gt;
</pre>
<p>You&#8217;ll understand the need for SPAN tags with separate classes when you see the CSS.</p>
<h2>The CSS</h2>
<p>There are a good amount of styles but the most important are applied to the SPAN elements:</p>
<pre>
/* entire wrapper */
#animationWrapper	{
	width:300px;
	font-family:"proxima-nova-1","proxima-nova-2","Helvetica Neue","Arial",sans-serif;
	background:#222;
	padding:40px;
}

/* link which encapsulates SPANs */
#animationWrapper a {
	font-weight: 800;
	text-transform: uppercase;
	font-size: 42px;
	line-height: 0.9em;
	margin-bottom: 10px;
	display: block;
	position: relative;
	color: #E58;
	text-decoration: none
}

/* span and a - "workers" */
#animationWrapper a, #animationWrapper span {
	-webkit-transition: all 0.12s ease-out;
	-moz-transition: all 0.12s ease-out;
	-o-transition: all 0.12s ease-out;
	-ms-transition: all 0.12s ease-out;
	transition: all 0.12s ease-out;
}

#animationWrapper span {
	display: block;
	color: #555;
	text-shadow: 1px 1px black, 2px 2px black, 3px 3px black, 4px 4px black, 5px 5px black, 6px 6px black, 7px 7px black, 8px 8px black;
}

/* special size for the first item */
#animationWrapper .span1 {
	font-size: 76px;
	line-height: 0.8em;
}

#animationWrapper a:hover {
    color: #fff ;
    top: -3px;
    left: -3px;
}

/* all spans become white */
#animationWrapper a:hover span {
	color:#fff;
}

/* different colors for each SPAN */
#animationWrapper a:hover .span1 {
    text-shadow: 1px 1px #58E, 2px 2px #58E, 3px 3px #58E, 4px 4px #58E, 5px 5px #58E, 6px 6px #58E, 7px 7px #58E, 8px 8px #58E, 9px 9px #58E, 10px 10px #58E, 11px 11px #58E;
}

#animationWrapper a:hover .span2 {
    text-shadow: 1px 1px #F90, 2px 2px #F90, 3px 3px #F90, 4px 4px #F90, 5px 5px #F90, 6px 6px #F90, 7px 7px #F90, 8px 8px #F90, 9px 9px #F90, 10px 10px #F90, 11px 11px #F90;
}

#animationWrapper a:hover .span3 {
    text-shadow: 1px 1px #3C7, 2px 2px #3C7, 3px 3px #3C7, 4px 4px #3C7, 5px 5px #3C7, 6px 6px #3C7, 7px 7px #3C7, 8px 8px #3C7, 9px 9px #3C7, 10px 10px #3C7, 11px 11px #3C7;
}

#animationWrapper a:hover .span4 {
    text-shadow: 1px 1px #E58, 2px 2px #E58, 3px 3px #E58, 4px 4px #E58, 5px 5px #E58, 6px 6px #E58, 7px 7px #E58, 8px 8px #E58, 9px 9px #E58, 10px 10px #E58, 11px 11px #E58;
}
</pre>
<p>The plain state SPAN receives a base text-shadow value and also defines the transition properties which will be played upon hover.  Each SPAN contains its own class which controls its text-shadow color and width during hover.  The hover state then enacts those text-shadow and color properties.</p>
<div><a href="http://davidwalsh.name/dw-content/css-desandro.php">View Demo</a></p>
<div></div>
</div>
<p>Well done to David for his simple but classy CSS effect.  If we&#8217;re being honest, those are the best kind.</p>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/3f1d9_MQdloHZFHuA" height="1" width="1" /><br />
<a href="http://davidwalsh.name/feed/atom">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/duplicate-desandros-css-effect-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Five Useful Interactive CSS/jQuery Techniques Deconstructed</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/five-useful-interactive-cssjquery-techniques-deconstructed/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/five-useful-interactive-cssjquery-techniques-deconstructed/#comments</comments>
		<pubDate>Thu, 16 Jun 2011 23:10:25 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[web resources]]></category>
		<category><![CDATA[delight visitors]]></category>
		<category><![CDATA[drop down menus]]></category>
		<category><![CDATA[helvetica neue]]></category>
		<category><![CDATA[interactive techniques]]></category>
		<category><![CDATA[javascript techniques]]></category>
		<category><![CDATA[sans serif font]]></category>
		<category><![CDATA[span class]]></category>
		<category><![CDATA[text shadow]]></category>
		<category><![CDATA[text shadows]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/five-useful-interactive-cssjquery-techniques-deconstructed/</guid>
		<description><![CDATA[&#160;&#160; With the wide variety of CSS3 and JavaScript techniques available today, it&#8217;s easier than ever to create unique interactive websites that delight visitors and provide a more engaging user experience. In this article, we&#8217;ll walk through five interactive techniques that you can start using right now. We&#8217;ll cover: Animated text effects, Animated images without [...]]]></description>
			<content:encoded><![CDATA[<table width="650">
<tr>
<td width="650">
<div>
      <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/4bd71_advertisement.gif" alt="Advertisement in Five Useful Interactive CSS/jQuery Techniques Deconstructed" border="0" /><br />
      <a href="http://auslieferung.commindo-media-ressourcen.de/www/delivery/ck.php?zoneid=34" target="_blank"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/61df9_avw.php?zoneid=34" border="0" alt=" in Five Useful Interactive CSS/jQuery Techniques Deconstructed" /></a>&nbsp;<a href="http://auslieferung.commindo-media-ressourcen.de/www/delivery/ck.php?zoneid=35" target="_blank"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/bfb79_avw.php?zoneid=35" border="0" alt=" in Five Useful Interactive CSS/jQuery Techniques Deconstructed" /></a>&nbsp;<a href="http://auslieferung.commindo-media-ressourcen.de/www/delivery/ck.php?zoneid=36" target="_blank"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/31c2a_avw.php?zoneid=36" border="0" alt=" in Five Useful Interactive CSS/jQuery Techniques Deconstructed" /></a>
    </div>
</td>
</tr>
</table>
<p>With the wide variety of CSS3 and JavaScript techniques available today, it&#8217;s easier than ever to create unique interactive websites that delight visitors and provide a more engaging user experience.</p>
<p>In this article, we&#8217;ll walk through five interactive techniques that you can start using right now. We&#8217;ll cover:</p>
<ol>
<li>Animated <a href="http://www.smashingmagazine.com/2011/06/16/5-interactive-code-techniques-for-more-engaging-websites/#extruded-text">text effects</a>,</li>
<li><a href="http://www.smashingmagazine.com/2011/06/16/5-interactive-code-techniques-for-more-engaging-websites/#animated-images">Animated images</a> without GIFs,</li>
<li>More engaging <a href="http://www.smashingmagazine.com/2011/06/16/5-interactive-code-techniques-for-more-engaging-websites/#mega-dropdown">drop-down menus</a>,</li>
<li>Fancier <a href="http://www.smashingmagazine.com/2011/06/16/5-interactive-code-techniques-for-more-engaging-websites/#slideshow-navigation">slideshow navigation</a>,</li>
<li><a href="http://www.smashingmagazine.com/2011/06/16/5-interactive-code-techniques-for-more-engaging-websites/#animated-icons">Animated icons</a> for the hover state of buttons.</li>
</ol>
<p>Besides learning how to accomplish these specific tasks, you&#8217;ll also master a variety of <strong>useful CSS and jQuery tricks</strong> that you can leverage when creating your own interactive techniques. The solutions presented here are certainly not perfect, so any thoughts, ideas and suggestions on how you would solve these design problems would be very appreciated.</p>
<p>So, let&#8217;s dive in and start building more exciting websites!</p>
<p><a name="extruded-text"></a></p>
<h3>1. Extruded Text Effect</h3>
<p><a href="http://desandro.com/"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/7a942_extruded-text-effect.png" alt="Extruded-text-effect in Five Useful Interactive CSS/jQuery Techniques Deconstructed" width="307" height="215" class="alignnone size-full wp-image-100157" /></a></p>
<p>The footer of <a href="http://desandro.com/">David DeSandro&#8217;s website</a> uses extruded text that animates on mouseover. This interactive text effect is a quick and impressive way to add some flare to your website. With only a few lines of CSS3, we can make the text appear to pop out of the page in <strong>three dimensions</strong>.</p>
<ul>
<li><a href="http://jonraasch.com/demo/extrude-on-hover">View the demo</a></li>
</ul>
<p>First let&#8217;s set up some text (the code is copied from the original site):</p>
<pre>
&lt;span class="extruded"&gt;Extrude Me&lt;/span&gt;
</pre>
<p>And some basic styling (the code is copied from the original site):</p>
<pre>
body {
    background-color: #444;
    text-align: center;
}

.extruded {
    color: #888;
    font-family: proxima-nova-1, proxima-nova-2, 'Helvetica Neue', Arial, sans-serif;
    font-size: 48px;
    font-weight: bold;
    text-shadow: #000 3px 3px;
}
</pre>
<p>Here, we’ve applied some basic styles and added a <code>text-shadow</code>. But this text-shadow doesn&#8217;t look three-dimensional; to accomplish the extruded effect, we&#8217;ll need to <strong>add more text-shadows</strong>:</p>
<pre>
    text-shadow: #000 1px 1px, #000 2px 2px, #000 3px 3px;
</pre>
<p>This will add three different text-shadows to our text, stacked on top of each other to create the three dimensional appearance we want.</p>
<h4>Styling the Hover State</h4>
<p>Next, let&#8217;s add a hover state with a bigger text-shadow:</p>
<pre>
.extruded:hover {
    color: #FFF;
    text-shadow: #58E 1px 1px, #58E 2px 2px, #58E 3px 3px, #58E 4px 4px, #58E 5px 5px, #58E 6px 6px;
}
</pre>
<p>Here, we’ve added three more text-shadows to <strong>increase the depth</strong> of the extrude effect. But this effect alone is too flat; we want the text to look like it&#8217;s popping off the page. So, let&#8217;s reposition the text to make it appear to grow taller from the base of the extruded section:</p>
<pre>
.extruded {
    position: relative;
}

.extruded:hover {
    color: #FFF;
    text-shadow: #58E 1px 1px, #58E 2px 2px, #58E 3px 3px, #58E 4px 4px, #58E 5px 5px, #58E 6px 6px;
    left: -6px;
    top: -6px;
}
</pre>
<p>Now in the hover state, the extruded text moves up the same distance as our max <code>text-shadow</code> value. We also added <code>position: relative</code>, which must be attached to the base state, not just the hover state, or else it will cause problems when we animate it.</p>
<h4>Animating the Transition</h4>
<p>Next, we can add a <a href="http://net.tutsplus.com/tutorials/html-css-techniques/css-fundametals-css-3-transitions/">CSS3 transition</a> to our text to animate the color change and extrude effect:</p>
<pre>
.extruded {
     -moz-transition: all 0.3s ease-out; /* FF3.7+ */
       -o-transition: all 0.3s ease-out; /* Opera 10.5 */
  -webkit-transition: all 0.3s ease-out; /* Saf3.2+, Chrome */
          transition: all 0.3s ease-out;
}
</pre>
<p>This triggers a smooth animation for our different CSS changes on hover. While it doesn&#8217;t work in all browsers, it does degrade nicely to the basic hover effect.</p>
<p>Bringing it all together:</p>
<pre>
body {
    background-color: #444;
    text-align: center;
}

.extruded {
    color: #888;
    font-family: proxima-nova-1, proxima-nova-2, 'Helvetica Neue', Arial, sans-serif; /* the original site doesn't use the @font-face attribute */
    font-size: 48px;
    font-weight: bold;
    text-shadow: #000 1px 1px, #000 2px 2px, #000 3px 3px;
    position: relative;
    -moz-transition: all 0.3s ease-out; /* FF3.7+ */
       -o-transition: all 0.3s ease-out; /* Opera 10.5 */
  -webkit-transition: all 0.3s ease-out; /* Saf3.2+, Chrome */
          transition: all 0.3s ease-out;
}

.extruded:hover {
    color: #FFF;
    text-shadow: #58E 1px 1px, #58E 2px 2px, #58E 3px 3px, #58E 4px 4px, #58E 5px 5px, #58E 6px 6px;
    left: -6px;
    top: -6px;
}
</pre>
<h4>Shortcomings</h4>
<p>While applying several CSS3 text-shadows works well when the text is static, it falls a bit short when used alongside the transition animation.</p>
<p>In short, the biggest text-shadow animates just fine, but the other text-shadows aren&#8217;t applied until the animation completes. This causes a quick correction: the browser stutters with a basic drop-shadow before filling in the rest diagonally.</p>
<p>Fortunately, we can make this drawback relatively unnoticeable, provided that we follow a few style guidelines. Basically, we want to hide the bulk of the extruded portion with the top text. This means that we should generally use this effect with bolder fonts, such as the Proxima Nova family used by David DeSandro. Also, we should be careful to avoid text-shadows that are too big for the font. Tweak your settings with this in mind until the animated extrude looks believable.</p>
<p>Finally, this technique <strong>will not work in IE</strong>, because <code>text-shadow</code> is unsupported in all versions of IE (even IE9).</p>
<ul>
<li><a href="https://gist.github.com/957199">Download the complete example</a></li>
<li><a href="http://jonraasch.com/demo/extrude-on-hover">View the demo</a></li>
</ul>
<p><a name="animated-images"></a></p>
<h3>2. Animating A Background Image</h3>
<p><a href="http://lovenonsense.com/"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/7a942_animated-images.png" alt="Animated-images in Five Useful Interactive CSS/jQuery Techniques Deconstructed" width="500" height="244" class="alignnone size-full wp-image-100165" /></a></p>
<p>While we can easily animate text with a few lines of code, animating an image usually requires bigger and slower assets, such as <a href="http://www.gifmuseum.com/">animated GIFs</a> or Flash or HTML5 video. While complex animations will still depend on these technologies, we can create a compelling illusion of animation using CSS alone.</p>
<p><a href="http://lovenonsense.com/">Love Nonsense</a> uses a hover effect to alter the color of the images on the website. The trick here is to use a transparent PNG with a background color. The color of the PNG should match the website&#8217;s background, so that all of the transparent areas in the PNG show up when filled with a background color. Thus, the PNG should contain the <strong>negative space</strong> of the image you want to display (i.e. the shape you want should be transparent, and everything else should be the same color as the background).</p>
<p>Here&#8217;s an example of the Smashing Magazine logo with negative space:</p>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/7a942_inverse-negative-space.jpg" alt="Inverse-negative-space in Five Useful Interactive CSS/jQuery Techniques Deconstructed" width="500" height="200" class="alignnone size-full wp-image-100167" /></p>
<p>Notice <a href="http://jonraasch.com/demo/animated-image">in the demo</a> how when the background color is set to orange, it starts to look more like the real thing.</p>
<h4>The Code</h4>
<ul>
<li><a href="http://jonraasch.com/demo/animated-image">View the demo</a></li>
</ul>
<p>First, let&#8217;s do some basic mark-up:</p>
<pre>
&lt;div class="post-wrapper"&gt;
    &lt;h2 class="post-title"&gt;
        This is the title you hover over

        &lt;img src="knockout-image.png" class="post-image" alt="" /&gt;
    &lt;/h2&gt;

    &lt;p&gt;Some more text here.&lt;/p&gt;
&lt;/div&gt;
</pre>
<p>Here we include a post with a title, our knock-out image and a paragraph of text.</p>
<p>Next, let&#8217;s set up some static styles:</p>
<pre>
.post-wrapper {
    position: relative;
    padding-left: 240px;
}

.post-image {
    position: absolute;
    top: 0;
    left: 0;
    background-color: #bbb;
}

.post-title {
    color: #037072;
}
</pre>
<p>Here, we’ve set up the post&#8217;s wrapper with <code>position: relative</code> and with enough padding on the left side to absolutely position the image to the left of our post. We’ve also added a background color to our image; so now the positive space in our PNG shows up as light gray.</p>
<p>Next, let&#8217;s add some hover effects:</p>
<pre>
.post-title:hover {
    color: #d63c25;
}

.post-title:hover .post-image {
    background-color: #f04e36;
}
</pre>
<p>Now, when we hover over the title or the image, both will change color.</p>
<p>We can take this effect a step further by animating the transition:</p>
<pre>
.post-image {
    -webkit-transition: background-color 400ms ease-in;
    -moz-transition: background-color 400ms ease-in;
    transition: background-color 400ms ease-in;
}

.post-title {
    -webkit-transition: color 400ms ease-in;
    -moz-transition: color 400ms ease-in;
    transition: color 400ms ease-in;
}
</pre>
<p>Here, we’ve added a <a href="http://net.tutsplus.com/tutorials/html-css-techniques/css-fundametals-css-3-transitions/">CSS3 transition</a> to both the image and the title, which will make for a smooth color change animation.</p>
<p>Unfortunately, CSS3 transitions are not currently supported in IE9. However, even in unsupported browsers, the color change will still occur&#8202;&#8212;&#8202;it just won&#8217;t have a smooth animation.</p>
<p>If complete cross-browser support for the animation is important, you could always provide a jQuery version of the animation for unsupported browsers. Bear in mind, though, that jQuery&#8217;s <a href="http://api.jquery.com/animate/"><code>animate()</code> method</a> does not support color animations, so you&#8217;ll need to use a <a href="https://github.com/jquery/jquery-color">color plug-in</a>.</p>
<p>Putting all the CSS together:</p>
<pre>
.post-wrapper {
    position: relative;
    padding-left: 240px;
}

.post-image {
    position: absolute;
    top: 0;
    left: 0;
    background-color: #bbb;
    -webkit-transition: background-color 400ms ease-in;
    -moz-transition: background-color 400ms ease-in;
    transition: background-color 400ms ease-in;
}

.post-title {
    color: #037072;
    -webkit-transition: color 400ms ease-in;
    -moz-transition: color 400ms ease-in;
    transition: color 400ms ease-in;
}

/* add the hover states */

.post-title:hover {
    color: #d63c25;
}

.post-title:hover .post-image {
    background-color: #f04e36;
}
</pre>
<ul>
<li><a href="https://gist.github.com/957217">Download the complete example</a></li>
<li><a href="http://jonraasch.com/demo/animated-image">View the demo</a></li>
</ul>
<p><a name="mega-dropdown"></a></p>
<h3>3. Mega Dropdown</h3>
<p><a href="http://www.bohemiadesign.co.uk/"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/7a942_mega-dropdown-menu.jpg" alt="Mega-dropdown-menu in Five Useful Interactive CSS/jQuery Techniques Deconstructed" width="500" height="310" class="alignnone size-full wp-image-100172" /></a></p>
<p>One common design problem with dropdown menus is that they often contain a lot of items. Instead of presenting all of its items in a long single column, <a href="http://www.bohemiadesign.co.uk/">Bohemia Design</a> uses a <strong>multi-column dropdown</strong>. This approach not only looks great, but provides an opportunity to group the links and highlight the most important ones.</p>
<p>Let&#8217;s recreate this menu using CSS and jQuery.</p>
<ul>
<li><a href="http://jonraasch.com/demo/huge-dropdown-menu">View the demo</a></li>
</ul>
<h4>Building the Tabs</h4>
<p>Ideally, we would start with a lean and simple mark-up&#8230;</p>
<pre>
&lt;nav&gt;
    &lt;li&gt;&lt;a href="#"&gt;Tab 1&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;Tab 2&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;Tab 3&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;Tab 4&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;Tab 5&lt;/a&gt;&lt;/li&gt;
&lt;/nav&gt;
</pre>
<p>&#8230;and use <code>nav li a</code>, <code>nav &gt; li</code> or <code>nav li</code> to style the list items in the navigation. The child selector doesn&#8217;t work in IE6 and <code>nav li</code> would cause problems since there are additional LIs nested in the content area of the dropdown. If you absolutely need the site to work for IE6 users as well (and that&#8217;s what you sometimes will have to do), you&#8217;ll need to have markup similar to the original mark-up in this example:</p>
<pre>
&lt;ul id="main-nav"&gt;
    &lt;li class="main-nav-item"&gt;
        &lt;a href="#" class="main-nav-tab"&gt;Tab 1&lt;/a&gt;
    &lt;/li&gt;

    &lt;li class="main-nav-item"&gt;
        &lt;a href="#" class="main-nav-tab"&gt;Tab 2&lt;/a&gt;
    &lt;/li&gt;

    &lt;li class="main-nav-item"&gt;
        &lt;a href="#" class="main-nav-tab"&gt;Tab 3&lt;/a&gt;
    &lt;/li&gt;

    &lt;li class="main-nav-item"&gt;
        &lt;a href="#" class="main-nav-tab"&gt;Tab 4&lt;/a&gt;
    &lt;/li&gt;

    &lt;li class="main-nav-item"&gt;
        &lt;a href="#" class="main-nav-tab"&gt;Tab 5&lt;/a&gt;
    &lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>Next, let&#8217;s style these five tabs:</p>
<pre>
#main-nav {
    width: 800px;
    height: 50px;
    position: relative;
    list-style: none;
    padding: 0;
}

#main-nav .main-nav-item {
    display: inline;
}

#main-nav .main-nav-tab {
    float: left;
    width: 140px;
    height: 30px;
    padding: 10px;
    line-height: 30px;
    text-align: center;
    color: #FFF;
    text-decoration: none;
    font-size: 18px;
}
</pre>
<p>Although a lot of the CSS is specific to our example, there are a few important styles to note.</p>
<p>First, we’ve defined a height and width for our overall tab area and matched the total height and width of all five tabs, so that we can position the dropdown correctly. Next, we’ve defined <code>position: relative</code> for the tab wrapper, which will allow us to position the dropdown absolutely.</p>
<p>Then, we added <code>list-style: none</code> to the list wrapper, and <code>display: inline</code> to each list item, to eliminate any list styling.</p>
<p>Finally, we floated all of the tab links to the left.</p>
<h4>Building the Dropdown</h4>
<p>Now, let’s build the dropdown mark-up in one of our tab wrappers:</p>
<pre>
    &lt;li class="main-nav-item"&gt;
        &lt;a href="#" class="main-nav-tab"&gt;Tab 1&lt;/a&gt;

        &lt;div class="main-nav-dd"&gt;
            &lt;div class="main-nav-dd-column"&gt;
            Column content here
            &lt;/div&gt;
        &lt;/div&gt;

        &lt;div class="main-nav-dd"&gt;
            &lt;div class="main-nav-dd-column"&gt;
            Column content here
            &lt;/div&gt;
        &lt;/div&gt;

        &lt;div class="main-nav-dd"&gt;
            &lt;div class="main-nav-dd-column"&gt;
            Column content here
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/li&gt;
</pre>
<p>Next, let&#8217;s style this dropdown:</p>
<pre>
#main-nav .main-nav-dd {
    position: absolute;
    top: 50px;
    left: 0;
    margin: 0;
    padding: 0;
    background-color: #FFF;
    border-bottom: 4px solid #f60;
}

#main-nav .main-nav-dd-column {
    width: 130px;
    padding: 15px 20px 8px;
    display: table-cell;
    border-left: 1px solid #ddd;
    *float: left;
    *border-left: 0;
}

#main-nav .main-nav-dd-column:first-child {
    border-left: 0;
}
</pre>
<p>Here, we’ve positioned the dropdown absolutely, directly beneath the first tab.</p>
<p>Let’s set <code>display: table-cell</code> on all of the column wrappers, so that they display next to each other. But <code>table-cell</code> is not supported in IE6 or 7, so we’ve used an <a href="http://paulirish.com/2009/browser-specific-css-hacks/">attribute hack</a> as an alternative for IE6 and 7. This hack places an asterisk (<code>*</code>) before each of the attributes that are specific to IE6 and 7.</p>
<p>Thus, we’ve defined a backup for unsupported IEs, which is simply <code>float: left</code>. This works almost as well as <code>display: table-cell</code>, except that the floated elements don&#8217;t match each other’s height, so the borders between columns don&#8217;t line up. To avoid this minor issue, we simply remove the <code>border-left</code> using the same asterisk hack.</p>
<p>Finally, we remove the left border from the first column for all browsers. Although the <code>:first-child</code> pseudo-class doesn&#8217;t work properly in IE6, fortunately it doesn&#8217;t make a difference, because we’ve already hidden the borders in these browsers.</p>
<h4>Adding the Interaction</h4>
<p>We&#8217;ve built the mark-up and styles for our dropdown, but we still need to make the menu interactive. Let&#8217;s use jQuery to add a class to show and hide the dropdown:</p>
<pre>
$(function() {
    var $mainNav = $('#main-nav');

    $mainNav.children('.main-nav-item').hover(function(ev) {
        // show the dropdown
        $(this).addClass('main-nav-item-active');
    }, function(ev) {
        // hide the dropdown
        $(this).removeClass('main-nav-item-active');
    });
});
</pre>
<p>Here, we’ve attached a <a href="http://bavotasan.com/tutorials/a-simple-mouseover-hover-effect-with-jquery/">hover listener</a> to each list item, which adds and removes the class <code>main-nav-item-active</code>. Attach this to the list item rather than the tab itself, or else the dropdown will disappear when the user mouses off the tab and into the dropdown area.</p>
<p>Now we can use this class hook to hide and show the dropdown with CSS:</p>
<pre>
#main-nav .main-nav-dd {
    display: none;
}

#main-nav .main-nav-item-active .main-nav-dd {
    display: block;
}
</pre>
<p>Let&#8217;s use the <code>active</code> class to style the active tab:</p>
<pre>
#main-nav .main-nav-item-active .main-nav-tab {
    background-color: #FFF;
    color: #f60;
    -webkit-border-top-left-radius: 5px;
    -webkit-border-top-right-radius: 5px;
    -moz-border-radius-topleft: 5px;
    -moz-border-radius-topright: 5px;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
}
</pre>
<p>Here, we’ve changed the background and text colors and rounded the top corners (in supported browsers).</p>
<h4>Positioning the Dropdown</h4>
<p>Now the basic mouse interaction has been built and the dropdown displays on mouseover. Unfortunately, it is still not positioned correctly under each tab, so let&#8217;s add some more code to our hover events:</p>
<pre>
$(function() {
    var $mainNav = $('#main-nav');

    $mainNav.children('.main-nav-item').hover(function(ev) {
        var $this = $(this),
        $dd = $this.find('.main-nav-dd');

        // get the left position of this tab
        var leftPos = $this.find('.main-nav-tab').position().left;

        // position the dropdown

        $dd.css('left', leftPos);

        // show the dropdown
        $this.addClass('main-nav-item-active');
    }, function(ev) {

        // hide the dropdown
        $(this).removeClass('main-nav-item-active');
    });
});
</pre>
<p>Here, we use jQuery&#8217;s <a href="http://api.jquery.com/position/"><code>position()</code> method</a> to get the left offset from the current tab. We then use this value to position the dropdown directly beneath the appropriate tab.</p>
<p>However, with the tabs on the right side, the dropdown menu will end up poking out of the tab area. Besides looking bad, this could lead to <strong>overflow issues</strong>, with portions of the dropdown falling outside of the browser window.</p>
<p>Let&#8217;s fix the positioning with some JavaScript:</p>
<pre>
$(function() {
    var $mainNav = $('#main-nav'),
    navWidth = $mainNav.width();

    $mainNav.children('.main-nav-item').hover(function(ev) {
        var $this = $(this),
        $dd = $this.find('.main-nav-dd');

        // get the left position of this tab
        var leftPos = $this.find('.main-nav-tab').position().left;

        // get the width of the dropdown
        var ddWidth = $dd.width(),
        leftMax = navWidth - ddWidth;

        // position the dropdown
        $dd.css('left', Math.min(leftPos, leftMax) );

        // show the dropdown
        $this.addClass('main-nav-item-active');
    }, function(ev) {

        // hide the dropdown
        $(this).removeClass('main-nav-item-active');
    });
});
</pre>
<p>Here, we start by finding the overall width of the tab area. Because recalculating the width for each tab is not necessary, we can define it outside of our hover listener.</p>
<p>Next, we find the width of the dropdown and determine the maximum left value, which is the overall tab width minus the width of the dropdown.</p>
<p>Finally, instead of always positioning the dropdown directly beneath the tab, we use the <a href="http://www.tutorialspoint.com/javascript/math_min.htm"><code>Math.min()</code> method</a> to pick the lowest between the tab offset and the maximum left value.</p>
<p>Thus, we confine the dropdown to the area beneath the tabs and avoid any content issues.</p>
<h4>Other Approaches</h4>
<p>While this script is fully functional, we could still improve the <strong>user experience</strong>. Currently, when the user mouses away from the dropdown, the menu hides immediately. You could build a delay using <code>setTimeout()</code> to ensure that the dropdown remains visible when the user mouses away and then quickly mouses back. This creates a better experience, because it avoids hiding the dropdown during accidental movements.</p>
<p>If you&#8217;d rather avoid <code>setTimeout()</code>, you could also look into the <a href="http://cherne.net/brian/resources/jquery.hoverIntent.html">hoverIntent jQuery plug-in</a>, which makes fine-tuned control over mouse actions much easier.</p>
<p>Besides improving the user experience, you could also <strong>avoid jQuery altogether</strong> in all browsers except IE6.</p>
<p>Instead of using jQuery&#8217;s <code>hover()</code> listener, we could use the CSS pseudo-class <code>:hover</code> to hide and show the dropdown.</p>
<p>One downside with the CSS-only solution is that you can&#8217;t build a delay for the <code>:hover</code> pseudo-class.</p>
<p>Also, you will have to position the dropdown manually under each tab to avoid the overflow issues. Alternatively, if you aren&#8217;t concerned with overflow issues, you could attach <code>position: relative</code> to each list item and avoid setting any positions manually.</p>
<p>Finally, if you’re supporting IE6, make sure to include the script above as a backup for IE6 (but don&#8217;t include it for other browsers).</p>
<ul>
<li><a href="https://gist.github.com/957213">Download the complete example</a></li>
<li><a href="http://jonraasch.com/demo/huge-dropdown-menu">View the demo</a></li>
</ul>
<p><a name="slideshow-navigation"></a></p>
<h3>4. Animated Slideshow Navigation</h3>
<p><a href="http://mckinney.com/"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/5d58d_animated-slideshow-navigation.jpg" alt="Animated-slideshow-navigation in Five Useful Interactive CSS/jQuery Techniques Deconstructed" width="500" height="268" class="alignnone size-full wp-image-100174" /></a></p>
<p>There are a lot of JavaScript slideshow techniques, but the animated navigation on <a href="http://mckinney.com/">McKinney</a> is a fresh, subtle approach.</p>
<h4>Basic jQuery Slideshow</h4>
<ul>
<li><a href="http://jonraasch.com/demo/fancy-slideshow-navigation">View the demo</a></li>
</ul>
<p>Let&#8217;s build something similar. We&#8217;ll start with some mark-up for a basic slideshow:</p>
<pre>
&lt;div id="slideshow"&gt;
    &lt;div id="slideshow-reel"&gt;
        &lt;div class="slide"&gt;
            &lt;h1&gt;Slide 1&lt;/h1&gt;
        &lt;/div&gt;

        &lt;div class="slide"&gt;
            &lt;h1&gt;Slide 2&lt;/h1&gt;
        &lt;/div&gt;

        &lt;div class="slide"&gt;
            &lt;h1&gt;Slide 3&lt;/h1&gt;
        &lt;/div&gt;

        &lt;div class="slide"&gt;
            &lt;h1&gt;Slide 4&lt;/h1&gt;
        &lt;/div&gt;

        &lt;div class="slide"&gt;
            &lt;h1&gt;Slide 5&lt;/h1&gt;
        &lt;/div&gt;

        &lt;div class="slide"&gt;
            &lt;h1&gt;Slide 6&lt;/h1&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
</pre>
<p>Here we&#8217;ve set up six slides, which can be filled with any content we need. Let&#8217;s set up some CSS to display the slides as a horizontal reel:</p>
<pre>
#slideshow {
    width: 900px;
    height: 500px;
    overflow: hidden;
    position: relative;
}

#slideshow-reel {
    width: 5400px;
    height: 450px;
    position: absolute;
    top: 0;
    left: 0;
}

#slideshow-reel .slide {
    width: 900px;
    height: 450px;
    float: left;
    background-color: gray;
}
</pre>
<p>Here, we&#8217;ve defined the dimensions of the slideshow, along with <code>overflow: hidden</code> to hide the other slides in the reel. We&#8217;ve also defined the dimensions of the reel: with six slides at 900 pixels each, it is 5400 pixels wide. (You could also just set this to a really high number, like 10000 pixels.) Then, we absolutely positioned the reel inside the slideshow (which has <code>position: relative</code>). Finally, we defined the dimensions for all of the individual slides and floated them to the left to fill up our reel.</p>
<h4>Basic Slideshow Animation</h4>
<p>Now, let&#8217;s add some jQuery to animate this slideshow:</p>
<pre>
$(function() {
    function changeSlide( newSlide ) {
        // change the currSlide value
        currSlide = newSlide;

        // make sure the currSlide value is not too low or high
        if ( currSlide &gt; maxSlide ) currSlide = 0;
        else if ( currSlide &lt; 0 ) currSlide = maxSlide;

        // animate the slide reel
        $slideReel.animate({
            left : currSlide * -900
        }, 400, &#039;swing&#039;, function() {
            // set new timeout if active
            if ( activeSlideshow ) slideTimeout = setTimeout(nextSlide, 1200);
        });
    }

    function nextSlide() {
        changeSlide( currSlide + 1 );
    }

    // define some variables / DOM references
    var activeSlideshow = true,
    currSlide = 0,
    slideTimeout,
    $slideshow = $(&#039;#slideshow&#039;),
    $slideReel = $slideshow.find(&#039;#slideshow-reel&#039;),
    maxSlide = $slideReel.children().length - 1;

    // start the animation
    slideTimeout = setTimeout(nextSlide, 1200);
});
</pre>
<p>Here, we’ve started by creating the function <code>changeSlide()</code>, which animates the slide reel. This function accepts an index for the next slide to show, and it checks to make sure that the value isn&#8217;t too high or low to be in the reel.</p>
<p>Next, it animates the slide reel to the appropriate position, and then finishes by setting a new <a href="http://www.elated.com/articles/javascript-timers-with-settimeout-and-setinterval/">timeout</a> to trigger the next iteration.</p>
<p>Finally, we’ve built the function <code>nextSlide()</code>, which simply triggers <code>changeSlide()</code> to show the next slide in the reel. This simple function is just a shortcut to be used with <code>setTimeout()</code>.</p>
<h4>The Left and Right Navigation</h4>
<p>Next, let&#8217;s set up the left and right arrows in the slideshow, starting with the mark-up:</p>
<pre>
    &lt;a href="#" id="slideshow-prev"&gt;&lt;/a&gt;
    &lt;a href="#" id="slideshow-next"&gt;&lt;/a&gt;
</pre>
<p>For simplicity&#8217;s sake, we&#8217;ve added the mark-up to the HTML source. Appending it to the jQuery is often a better approach, to ensure that the controls appear only when they are usable.</p>
<p>Let&#8217;s style these arrows with CSS:</p>
<pre>
#slideshow-prev, #slideshow-next {
    display: block;
    position: absolute;
    top: 190px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 28px 21px;
    border-color: transparent;
    outline: none;
}

#slideshow-prev:hover, #slideshow-next:hover {
    opacity: .5;
    filter: alpha(opacity=50);
    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
}

#slideshow-prev {
    left: 0;
    border-right-color: #fff;
}

#slideshow-next {
    right: 0;
    border-left-color: #fff;
}
</pre>
<p>We’ve positioned the arrows absolutely within the slideshow frame and added an opacity change on hover. In our example, we’ve used a <a href="http://www.dinnermint.org/blog/css/creating-triangles-in-css/">CSS triangle trick</a> to style the arrows with straight CSS, but feel free to use an image if you want richer graphics.</p>
<p>Finally, let&#8217;s build the required interaction into our JavaScript:</p>
<pre>
$(function() {
    function changeSlide( newSlide ) {
        // cancel any timeout
        clearTimeout( slideTimeout );

        // change the currSlide value
        currSlide = newSlide;

        // make sure the currSlide value is not too low or high
        if ( currSlide &gt; maxSlide ) currSlide = 0;
        else if ( currSlide &lt; 0 ) currSlide = maxSlide;

        // animate the slide reel
        $slideReel.animate({
            left : currSlide * -900
        }, 400, 'swing', function() {
            // hide / show the arrows depending on which frame it's on
            if ( currSlide == 0 ) $slidePrevNav.hide();
            else $slidePrevNav.show();

            if ( currSlide == maxSlide ) $slideNextNav.hide();
            else $slideNexNav.show();

            // set new timeout if active
            if ( activeSlideshow ) slideTimeout = setTimeout(nextSlide, 1200);
        });

        // animate the navigation indicator
        $activeNavItem.animate({
            left : currSlide * 150
        }, 400, 'swing');
    }

    function nextSlide() {
        changeSlide( currSlide + 1 );
    }

    // define some variables / DOM references
    var activeSlideshow = true,
    currSlide = 0,
    slideTimeout,
    $slideshow = $('#slideshow'),
    $slideReel = $slideshow.find('#slideshow-reel'),
    maxSlide = $slideReel.children().length - 1,
    $slidePrevNav = $slideshow.find('#slideshow-prev'),
    $slideNextNav = $slideshow.find('#slideshow-next');

    // set navigation click events

    // left arrow
    $slidePrevNav.click(function(ev) {
        ev.preventDefault();

        activeSlideshow = false;

        changeSlide( currSlide - 1 );
    });

    // right arrow
    $slideNextNav.click(function(ev) {
        ev.preventDefault();

        activeSlideshow = false;

        changeSlide( currSlide + 1 );
    });

    // start the animation
    slideTimeout = setTimeout(nextSlide, 1200);
});
</pre>
<p>Here, we&#8217;ve added quite a bit of new interaction. First, look at the bottom of this script, where we&#8217;ve added click event listeners to both of our navigational items.</p>
<p>In these functions, we have first set <code>activeSlideshow</code> to <code>false</code>, which disables the automatic animation of the reel. This provides a better user experience by allowing the user to control the reel manually. Then, we trigger either the previous or next slide using <code>changeSlide()</code>. Next, in the <code>changeSlide()</code> function, we&#8217;ve added a <a href="http://programming.top54u.com/post/JavaScript-clearTimeout.aspx">clearTimeout()</a>. This works in conjunction with the <code>activeSlideshow</code> value, cancelling any hanging iteration from a <code>setTimeout</code>.</p>
<p>Finally, in the callback of the <code>animate()</code> function, we&#8217;ve added some code to hide and show the arrow navigation. This hides the left arrow when the slideshow is showing the left-most slide, and vice versa.</p>
<h4>Animating the Bottom Navigation</h4>
<p>The basic slideshow works with the previous and next arrows. Let&#8217;s take it to the next level by adding the animated navigation. Please note that I am using a more complex markup because it avoids the use of images and is ultimately simpler. It would have to use three background images otherwise &mdash; one for the center sections and one for each cap to allow the clickable areas to be larger). However, you could clean up the bottom navigation with a background-image.</p>
<p>Here is the jQuery code for animation:</p>
<pre>
$(function() {
    function changeSlide( newSlide ) {
        // cancel any timeout
        clearTimeout( slideTimeout );

        // change the currSlide value
        currSlide = newSlide;

        // make sure the currSlide value is not too low or high
        if ( currSlide &gt; maxSlide ) currSlide = 0;
        else if ( currSlide &lt; 0 ) currSlide = maxSlide;

        // animate the slide reel
        $slideReel.animate({
            left : currSlide * -900
        }, 400, 'swing', function() {
            // hide / show the arrows depending on which frame it's on
            if ( currSlide == 0 ) $slidePrevNav.hide();
            else $slidePrevNav.show();

            if ( currSlide == maxSlide ) $slideNextNav.hide();
            else $slideNextNav.show();

            // set new timeout if active
            if ( activeSlideshow ) slideTimeout = setTimeout(nextSlide, 1200);
        });

        // animate the navigation indicator
        $activeNavItem.animate({
            left : currSlide * 150
        }, 400, 'swing');
    }

    function nextSlide() {
        changeSlide( currSlide + 1 );
    }

    // define some variables / DOM references
    var activeSlideshow = true,
    currSlide = 0,
    slideTimeout,
    $slideshow = $('#slideshow'),
    $slideReel = $slideshow.find('#slideshow-reel'),
    maxSlide = $slideReel.children().length - 1,
    $slidePrevNav = $slideshow.find('#slideshow-prev'),
    $slideNextNav = $slideshow.find('#slideshow-next'),
    $activeNavItem = $slideshow.find('#active-nav-item');

    // set navigation click events

    // left arrow
    $slidePrevNav.click(function(ev) {
        ev.preventDefault();

        activeSlideshow = false;

        changeSlide( currSlide - 1 );
    });

    // right arrow
    $slideNextNav.click(function(ev) {
        ev.preventDefault();

        activeSlideshow = false;

        changeSlide( currSlide + 1 );
    });

    // main navigation
    $slideshow.find('#slideshow-nav a.nav-item').click(function(ev) {
        ev.preventDefault();

        activeSlideshow = false;

        changeSlide( $(this).index() );
    });

    // start the animation
    slideTimeout = setTimeout(nextSlide, 1200);
});
</pre>
<p>We&#8217;ve added a couple of things to our script.</p>
<p>First, we&#8217;ve included a second animation in <code>changeSlide()</code>, this time to animate the active indicator in the navigation. This <code>animate()</code> is basically the same as the one we built for the reel, the main difference being that we want to move it only <code>150px</code> per slide.</p>
<p>Finally, we added a click event listener to the items in the bottom navigation. Similar to the arrow navigation, we start by disabling the automatic animation, setting <code>activeSlideshow</code> to <code>false</code>. Next, we trigger <code>changeSlide()</code>, passing in the index of whichever slide was clicked, which is easy to determine using jQuery&#8217;s <a href="http://api.jquery.com/index/"><code>index()</code></a> method.</p>
<p>Now the slideshow navigation animation is complete and ready to impress your visitors.</p>
<ul>
<li><a href="https://gist.github.com/957203">Download the complete example</a></li>
<li><a href="http://jonraasch.com/demo/fancy-slideshow-navigation">View the demo</a></li>
</ul>
<p><a name="animated-icons"></a></p>
<h3>5. Animated Icons</h3>
<p><a href="http://css-tricks.com"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/5d58d_animated-icons-on-css-tricks.png" alt="Animated-icons-on-css-tricks in Five Useful Interactive CSS/jQuery Techniques Deconstructed" width="500" height="143" class="alignnone size-full wp-image-100175" /></a></p>
<p><a href="http://css-tricks.com">CSS-Tricks</a> has a simple but elegant effect in its footer when the user mouses over various buttons. Besides the color changing and an icon being added, the effect is animated in browsers that support transition, making the icon appear to <strong>slide into place</strong>.</p>
<ul>
<li><a href="http://jonraasch.com/demo/animated-icons">View the demo</a></li>
</ul>
<p>Let&#8217;s create a similar effect, starting with some mark-up:</p>
<pre>
&lt;a href="#" class="hover-panel"&gt;
    &lt;h3&gt;Panel Title&lt;/h3&gt;

    &lt;p&gt;Additional information about the panel goes in a paragraph here&lt;/p&gt;
&lt;/a&gt;
</pre>
<p>One thing to note about this mark-up is that it has block elements nested in an <code>&lt;a&gt;</code> element, which makes sense semantically, but it&#8217;s valid only if you&#8217;re using the HTML5 doc type.</p>
<h4>Styling the Buttons</h4>
<p>Let&#8217;s set up some basic CSS to style the block in its natural (non-hovered) state:</p>
<pre>
.hover-panel {
    background-color: #E6E2DF;
    color: #B2AAA4;
    float: left;
    height: 130px;
    width: 262px;
    margin: 0 10px 10px 0;
    padding: 15px;
}

.hover-panel h3 {
    font-family: tandelle-1, tandelle-2, Impact, Sans-serif, sans;
    font-size: 38px;
    line-height: 1;
    margin: 0 0 10px;
    text-transform: uppercase;
}

.hover-panel p {
    font-size: 12px;
    width: 65%;
}
</pre>
<p>Now let&#8217;s add a static hover effect to change some of the colors and add a drop shadow:</p>
<pre>
.hover-panel:hover {
    background-color: #237ABE;
}

.hover-panel:hover h3 {
    color: #FFF;
    text-shadow: rgba(0, 0, 0, 0.398438) 0px 0px 4px;
}

.hover-panel:hover p {
    color: #FFF:
}
</pre>
<p>Finally, let&#8217;s add a background image that pops into place on hover:</p>
<pre>
.hover-panel {
    background-image: url(hover-panel-icon.png);
    background-position: 292px 10px;
    background-repeat: no-repeat;
}

.hover-panel:hover {
    background-position: 180px 10px;
}
</pre>
<p>Here, we&#8217;ve added a few important styles to accomplish the hover effect. First, we&#8217;ve attached the background image to our <code>.hover-panel</code>. This is normally positioned outside of the button, but on mouseover, it is placed correctly. Also, note that we&#8217;ve placed it off to the right side of the panel, so that when we apply the transition animation, the icon will slide in from the right.</p>
<h4>Animating the Transition</h4>
<p>Finally, let&#8217;s add the transition:</p>
<pre>
.hover-panel {
     -moz-transition: all 0.2s ease; /* FF3.7+ */
       -o-transition: all 0.2s ease; /* Opera 10.5 */
  -webkit-transition: all 0.2s ease; /* Saf3.2+, Chrome */
          transition: all 0.2s ease;
}
</pre>
<p>The transition effect triggers the animation of the background image. Because we&#8217;ve flagged it to apply to <code>all</code> attributes, the transition will also be applied to the <code>background-color</code> change that we applied above.</p>
<p>Although this works in most modern browsers, it will not work in IE9. But even in unsupported browsers, the user will see the color change and icon; they just won&#8217;t see the animation effect.</p>
<p>On most websites, this enhancement wouldn&#8217;t be necessary for all users. But if support is a priority, look into this <a href="http://jonraasch.com/blog/graceful-degradation-with-css3#transitions">jQuery back-up</a>.</p>
<p>Finally, let&#8217;s bring all of the styles together:</p>
<pre>
.hover-panel {
    background-color: #E6E2DF;
    background-image: url(hover-panel-icon.png);
    background-position: 292px 10px;
    background-repeat: no-repeat;
    color: #B2AAA4;
    display: block;
    float: left;
    height: 130px;
    width: 262px;
    margin: 0 10px 10px 0;
    padding: 15px;
     -moz-transition: all 0.2s ease; /* FF3.7+ */
       -o-transition: all 0.2s ease; /* Opera 10.5 */
  -webkit-transition: all 0.2s ease; /* Saf3.2+, Chrome */
          transition: all 0.2s ease;
}

.hover-panel h3 {
    font-family: tandelle-1, tandelle-2, Impact, Sans-serif, sans;
    font-size: 38px;
    line-height: 1;
    margin: 0 0 10px;
    text-transform: uppercase;
}

.hover-panel p {
    font-size: 12px;
    width: 65%;
}

.hover-panel:hover {
    background-color: #237ABE;
    background-position: 180px 10px;
}

.hover-panel:hover h3 {
    color: #FFF;
    text-shadow: rgba(0, 0, 0, 0.398438) 0px 0px 4px;
}

.hover-panel:hover p {
    color: #FFF:
}
</pre>
<ul>
<li><a href="https://gist.github.com/957236">Download the complete example</a></li>
<li><a href="http://jonraasch.com/demo/animated-icons">View the demo</a></li>
</ul>
<h3>Final Thoughts</h3>
<p>In this article, we&#8217;ve walked through a variety of interactive techniques that can add a bit of style and creativity to your website. Used correctly, techniques like these enhance websites, creating a more engaging and memorable user experience. But be subtle with the interactivity, ensuring that the bells and whistles do not get in the way of the website&#8217;s primary function, which is to <strong>providing meaningful content</strong>.</p>
<p>What do you think of the techniques presented here?  Do you know of any ways to improve these scripts?  What are some other interactive techniques that you&#8217;ve seen around the Web?</p>
<p><em>(al)</em></p>
<hr />
<p>© Jon Raasch for <a href="http://www.smashingmagazine.com">Smashing Magazine</a>, 2011. |<br />
<a href="http://www.smashingmagazine.com/2011/06/16/5-interactive-code-techniques-for-more-engaging-websites/">Permalink</a> |<br />
<a href="http://www.smashingmagazine.com/2011/06/16/5-interactive-code-techniques-for-more-engaging-websites/#comments">Post a comment</a> |<br />
<a href="http://shop.smashingmagazine.com/" title="Smashing Shop">Smashing Shop</a> |<br />
<a href="http://www.smashingmagazine.com/the-smashing-network/" title="Smashing Network">Smashing Network</a> |<br />
<a href="http://www.smashingmagazine.com/about/" title="About Us">About Us</a></p>
<p>
Post tags: 
</p>
<p><a href="http://rss1.smashingmagazine.com/feed/">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/five-useful-interactive-cssjquery-techniques-deconstructed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Duplicate DeSandro&#8217;s CSS Effect</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/duplicate-desandros-css-effect/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/duplicate-desandros-css-effect/#comments</comments>
		<pubDate>Tue, 14 Jun 2011 00:36:32 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[web resources]]></category>
		<category><![CDATA[brilliant idea]]></category>
		<category><![CDATA[css effects]]></category>
		<category><![CDATA[div id]]></category>
		<category><![CDATA[helvetica neue]]></category>
		<category><![CDATA[j walsh]]></category>
		<category><![CDATA[sans serif]]></category>
		<category><![CDATA[span class]]></category>
		<category><![CDATA[span elements]]></category>
		<category><![CDATA[text shadow]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/duplicate-desandros-css-effect/</guid>
		<description><![CDATA[I recently stumbled upon David DeSandro&#8217;s website when I saw a tweet stating that someone had stolen/hotlinked his website design and code, and he decided to do the only logical thing to retaliate:  use some simple JavaScript goodness to inject unicorns into their page.  A brilliant idea, if I may say so myself (and I [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://davidwalsh.name/dw-content/css-desandro.php"></a></p>
<p>I recently stumbled upon <a href="http://desandro.com/">David DeSandro&#8217;s website</a> when I saw a tweet stating that someone had stolen/hotlinked his website design and code, and he decided to do the only logical thing to retaliate:  use some simple JavaScript goodness to inject unicorns into their page.  A brilliant idea, if I may say so myself <em>(and I may)</em>.  David&#8217;s design is simplistic but features a few classy CSS effects, one of the most impressive being the footer &#8220;made this&#8221; animation.  Let me show you how David accomplished this effect.</p>
<div><a href="http://davidwalsh.name/dw-content/css-desandro.php">View Demo</a></p>
<div></div>
</div>
<h2>The HTML</h2>
<p>The system will consist of a wrapper (though it&#8217;s not necessarily needed), an link, and a series of SPAN tags:</p>
<pre>
&lt;div id="animationWrapper"&gt;
	&lt;a href="/"&gt;
		&lt;span class="span1"&gt;David&lt;/span&gt;
		&lt;span class="span2"&gt;J. Walsh&lt;/span&gt;
		&lt;span class="span3"&gt;Arsenal&lt;/span&gt;
		&lt;span class="span4"&gt;Legend&lt;/span&gt;
	&lt;/a&gt;
&lt;/div&gt;
</pre>
<p>You&#8217;ll understand the need for SPAN tags with separate classes when you see the CSS.</p>
<h2>The CSS</h2>
<p>There are a good amount of styles but the most important are applied to the SPAN elements:</p>
<pre>
/* entire wrapper */
#animationWrapper	{
	width:300px;
	font-family:"proxima-nova-1","proxima-nova-2","Helvetica Neue","Arial",sans-serif;
	background:#222;
	padding:40px;
}

/* link which encapsulates SPANs */
#animationWrapper a {
	font-weight: 800;
	text-transform: uppercase;
	font-size: 42px;
	line-height: 0.9em;
	margin-bottom: 10px;
	display: block;
	position: relative;
	color: #E58;
	text-decoration: none
}

/* span and a - "workers" */
#animationWrapper a, #animationWrapper span {
	-webkit-transition: all 0.12s ease-out;
	-moz-transition: all 0.12s ease-out;
	-o-transition: all 0.12s ease-out;
	-ms-transition: all 0.12s ease-out;
	transition: all 0.12s ease-out;
}

#animationWrapper span {
	display: block;
	color: #555;
	text-shadow: 1px 1px black, 2px 2px black, 3px 3px black, 4px 4px black, 5px 5px black, 6px 6px black, 7px 7px black, 8px 8px black;
}

/* special size for the first item */
#animationWrapper .span1 {
	font-size: 76px;
	line-height: 0.8em;
}

#animationWrapper a:hover {
    color: #fff ;
    top: -3px;
    left: -3px;
}

/* all spans become white */
#animationWrapper a:hover span {
	color:#fff;
}

/* different colors for each SPAN */
#animationWrapper a:hover .span1 {
    text-shadow: 1px 1px #58E, 2px 2px #58E, 3px 3px #58E, 4px 4px #58E, 5px 5px #58E, 6px 6px #58E, 7px 7px #58E, 8px 8px #58E, 9px 9px #58E, 10px 10px #58E, 11px 11px #58E;
}

#animationWrapper a:hover .span2 {
    text-shadow: 1px 1px #F90, 2px 2px #F90, 3px 3px #F90, 4px 4px #F90, 5px 5px #F90, 6px 6px #F90, 7px 7px #F90, 8px 8px #F90, 9px 9px #F90, 10px 10px #F90, 11px 11px #F90;
}

#animationWrapper a:hover .span3 {
    text-shadow: 1px 1px #3C7, 2px 2px #3C7, 3px 3px #3C7, 4px 4px #3C7, 5px 5px #3C7, 6px 6px #3C7, 7px 7px #3C7, 8px 8px #3C7, 9px 9px #3C7, 10px 10px #3C7, 11px 11px #3C7;
}

#animationWrapper a:hover .span4 {
    text-shadow: 1px 1px #E58, 2px 2px #E58, 3px 3px #E58, 4px 4px #E58, 5px 5px #E58, 6px 6px #E58, 7px 7px #E58, 8px 8px #E58, 9px 9px #E58, 10px 10px #E58, 11px 11px #E58;
}
</pre>
<p>The plain state SPAN receives a base text-shadow value and also defines the transition properties which will be played upon hover.  Each SPAN contains its own class which controls its text-shadow color and width during hover.  The hover state then enacts those text-shadow and color properties.</p>
<div><a href="http://davidwalsh.name/dw-content/css-desandro.php">View Demo</a></p>
<div></div>
</div>
<p>Well done to David for his simple but classy CSS effect.  If we&#8217;re being honest, those are the best kind.</p>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/cee89_ne7z6fakcRc" height="1" width="1" /><br />
<a href="http://davidwalsh.name/feed/atom">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/duplicate-desandros-css-effect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Duplicate DeSandro&#8217;s CSS&#160;Effect</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/duplicate-desandros-csseffect/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/duplicate-desandros-csseffect/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 17:42:22 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[web resources]]></category>
		<category><![CDATA[brilliant idea]]></category>
		<category><![CDATA[css effects]]></category>
		<category><![CDATA[div id]]></category>
		<category><![CDATA[helvetica neue]]></category>
		<category><![CDATA[j walsh]]></category>
		<category><![CDATA[sans serif]]></category>
		<category><![CDATA[span class]]></category>
		<category><![CDATA[span elements]]></category>
		<category><![CDATA[text shadow]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/duplicate-desandros-csseffect/</guid>
		<description><![CDATA[I recently stumbled upon David DeSandro&#8217;s website when I saw a tweet stating that someone had stolen/hotlinked his website design and code, and he decided to do the only logical thing to retaliate:  use some simple JavaScript goodness to inject unicorns into their page.  A brilliant idea, if I may say so myself (and I [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://davidwalsh.name/dw-content/css-desandro.php"></a>
<p>I recently stumbled upon <a href="http://desandro.com/">David DeSandro&#8217;s website</a> when I saw a tweet stating that someone had stolen/hotlinked his website design and code, and he decided to do the only logical thing to retaliate:  use some simple JavaScript goodness to inject unicorns into their page.  A brilliant idea, if I may say so myself <em>(and I may)</em>.  David&#8217;s design is simplistic but features a few classy CSS effects, one of the most impressive being the footer &#8220;made this&#8221; animation.  Let me show you how David accomplished this effect.</p>
<div><a href="http://davidwalsh.name/dw-content/css-desandro.php">View Demo</a>
<div></div>
</div>
<h2>The&nbsp;HTML</h2>
<p>The system will consist of a wrapper (though it&#8217;s not necessarily needed), an link, and a series of SPAN tags:</p>
<pre>
&lt;div id="animationWrapper"&gt;
	&lt;a href="/"&gt;
		&lt;span class="span1"&gt;David&lt;/span&gt;
		&lt;span class="span2"&gt;J. Walsh&lt;/span&gt;
		&lt;span class="span3"&gt;Arsenal&lt;/span&gt;
		&lt;span class="span4"&gt;Legend&lt;/span&gt;
	&lt;/a&gt;
&lt;/div&gt;
</pre>
<p>You&#8217;ll understand the need for SPAN tags with separate classes when you see the CSS.</p>
<h2>The&nbsp;CSS</h2>
<p>There are a good amount of styles but the most important are applied to the SPAN elements:</p>
<pre>
/* entire wrapper */
#animationWrapper	{
	width:300px;
	font-family:"proxima-nova-1","proxima-nova-2","Helvetica Neue","Arial",sans-serif;
	background:#222;
	padding:40px;
}

/* link which encapsulates SPANs */
#animationWrapper a {
	font-weight: 800;
	text-transform: uppercase;
	font-size: 42px;
	line-height: 0.9em;
	margin-bottom: 10px;
	display: block;
	position: relative;
	color: #E58;
	text-decoration: none
}

/* span and a - "workers" */
#animationWrapper a, #animationWrapper span {
	-webkit-transition: all 0.12s ease-out;
	-moz-transition: all 0.12s ease-out;
	-o-transition: all 0.12s ease-out;
	-ms-transition: all 0.12s ease-out;
	transition: all 0.12s ease-out;
}

#animationWrapper span {
	display: block;
	color: #555;
	text-shadow: 1px 1px black, 2px 2px black, 3px 3px black, 4px 4px black, 5px 5px black, 6px 6px black, 7px 7px black, 8px 8px black;
}

/* special size for the first item */
#animationWrapper .span1 {
	font-size: 76px;
	line-height: 0.8em;
}

#animationWrapper a:hover {
    color: #fff ;
    top: -3px;
    left: -3px;
}

/* all spans become white */
#animationWrapper a:hover span {
	color:#fff;
}

/* different colors for each SPAN */
#animationWrapper a:hover .span1 {
    text-shadow: 1px 1px #58E, 2px 2px #58E, 3px 3px #58E, 4px 4px #58E, 5px 5px #58E, 6px 6px #58E, 7px 7px #58E, 8px 8px #58E, 9px 9px #58E, 10px 10px #58E, 11px 11px #58E;
}

#animationWrapper a:hover .span2 {
    text-shadow: 1px 1px #F90, 2px 2px #F90, 3px 3px #F90, 4px 4px #F90, 5px 5px #F90, 6px 6px #F90, 7px 7px #F90, 8px 8px #F90, 9px 9px #F90, 10px 10px #F90, 11px 11px #F90;
}

#animationWrapper a:hover .span3 {
    text-shadow: 1px 1px #3C7, 2px 2px #3C7, 3px 3px #3C7, 4px 4px #3C7, 5px 5px #3C7, 6px 6px #3C7, 7px 7px #3C7, 8px 8px #3C7, 9px 9px #3C7, 10px 10px #3C7, 11px 11px #3C7;
}

#animationWrapper a:hover .span4 {
    text-shadow: 1px 1px #E58, 2px 2px #E58, 3px 3px #E58, 4px 4px #E58, 5px 5px #E58, 6px 6px #E58, 7px 7px #E58, 8px 8px #E58, 9px 9px #E58, 10px 10px #E58, 11px 11px #E58;
}
</pre>
<p>The plain state SPAN receives a base text-shadow value and also defines the transition properties which will be played upon hover.  Each SPAN contains its own class which controls its text-shadow color and width during hover.  The hover state then enacts those text-shadow and color properties.</p>
<div><a href="http://davidwalsh.name/dw-content/css-desandro.php">View Demo</a>
<div></div>
</div>
<p>Well done to David for his simple but classy CSS effect.  If we&#8217;re being honest, those are the best kind.</p>
<p><a href="http://davidwalsh.name/css-text-shadow">Duplicate DeSandro&#8217;s CSS&nbsp;Effect</a> is a post from: <a href="http://davidwalsh.name">David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</a></p>
<p>Related posts:
<ol>
<li><a href="http://davidwalsh.name/jquery-tooltips" rel="bookmark" title="Permanent Link: Duplicate the jQuery Homepage Tooltips">Duplicate the jQuery Homepage&nbsp;Tooltips</a></li>
<li><a href="http://davidwalsh.name/jquery-homepage-mootools" rel="bookmark" title="Permanent Link: Duplicate the jQuery Homepage Tooltips Using MooTools">Duplicate the jQuery Homepage Tooltips Using&nbsp;MooTools</a></li>
<li><a href="http://davidwalsh.name/dojo-tooltips" rel="bookmark" title="Permanent Link: Duplicate the jQuery Homepage Tooltips Using Dojo">Duplicate the jQuery Homepage Tooltips Using&nbsp;Dojo</a></li>
<li><a href="http://davidwalsh.name/github-css" rel="bookmark" title="Permanent Link: Create GitHub-Style Buttons with CSS and jQuery, MooTools, or Dojo JavaScript">Create GitHub-Style Buttons with CSS and jQuery, MooTools, or Dojo&nbsp;JavaScript</a></li>
<li><a href="http://davidwalsh.name/faux-select" rel="bookmark" title="Permanent Link: Dress Up Your Select Elements with FauxSelect">Dress Up Your Select Elements with&nbsp;FauxSelect</a></li>
</ol>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/20fa7_0ibifH8qR-M" height="1" width="1" /><br />
<a href="http://davidwalsh.name/feed/atom">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/duplicate-desandros-csseffect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Photobooth with PHP, jQuery and CSS3</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/tutorial/photobooth-with-php-jquery-and-css3/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/tutorial/photobooth-with-php-jquery-and-css3/#comments</comments>
		<pubDate>Mon, 25 Apr 2011 20:56:33 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[tutorial]]></category>
		<category><![CDATA[css href]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[div class]]></category>
		<category><![CDATA[div id]]></category>
		<category><![CDATA[doctype html]]></category>
		<category><![CDATA[html structure]]></category>
		<category><![CDATA[meta charset]]></category>
		<category><![CDATA[s webcam]]></category>
		<category><![CDATA[span class]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/tutorial/photobooth-with-php-jquery-and-css3/</guid>
		<description><![CDATA[In this tutorial, we will be building a jQuery and PHP powered photobooth. It will allow your website visitors to take a snapshot with their web camera and upload it from a neat CSS3 interface. As you might know, it is not possible to access web cameras and other peripheral devices directly from JavaScript (and [...]]]></description>
			<content:encoded><![CDATA[<p>In this tutorial, we will be building a jQuery and PHP powered photobooth. It will allow your website visitors to take a snapshot with their web camera and upload it from a neat CSS3 interface.</p>
<p>As you might know, it is not possible to access web cameras and other peripheral devices directly from JavaScript (and it won&#8217;t be for some time). However there is a solution to our problem &#8211; we can use a flash movie. Flash has perfect web camera support, and is installed on nearly all internet &#8211; enabled computers.</p>
<p>The solution we are going to use for this app is <a href="http://code.google.com/p/jpegcam/" target="_blank">webcam.js</a>. It is a JavaScript wrapper around flash&#8217;s API that gives us control over the user&#8217;s webcam.</p>
<h3>HTML</h3>
<p>The first step to building our Photobooth is laying down the HTML structure of the main page. We will be using jQuery to fetch a list of the latest photos, so we don&#8217;t need to embed any PHP logic here. This means we can leave it as a plain HTML file.</p>
<h4>index.html</h4>
<pre>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta charset="utf-8" /&gt;
&lt;title&gt;Photobooth with PHP, jQuery and CSS3 | Tutorialzine Demo&lt;/title&gt;

&lt;link rel="stylesheet" type="text/css" href="assets/css/styles.css" /&gt;
&lt;link rel="stylesheet" type="text/css" href="assets/fancybox/jquery.fancybox-1.3.4.css" /&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;div id="topBar"&gt;
    &lt;h1&gt;jQuery &amp;amp; CSS3 Photobooth&lt;/h1&gt;
    &lt;h2&gt;&amp;laquo; Go back to Tutorialzine&lt;/h2&gt;
&lt;/div&gt;

&lt;div id="photos"&gt;&lt;/div&gt;

&lt;div id="camera"&gt;
	&lt;span class="tooltip"&gt;&lt;/span&gt;
	&lt;span class="camTop"&gt;&lt;/span&gt;

    &lt;div id="screen"&gt;&lt;/div&gt;
    &lt;div id="buttons"&gt;
    	&lt;div class="buttonPane"&gt;
        	&lt;a id="shootButton" href="" class="blueButton"&gt;Shoot!&lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="buttonPane hidden"&gt;
        	&lt;a id="cancelButton" href="" class="blueButton"&gt;Cancel&lt;/a&gt; &lt;a id="uploadButton" href="" class="greenButton"&gt;Upload!&lt;/a&gt;
        &lt;/div&gt;
    &lt;/div&gt;

    &lt;span class="settings"&gt;&lt;/span&gt;
&lt;/div&gt;

&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"&gt;&lt;/script&gt;
&lt;script src="assets/fancybox/jquery.easing-1.3.pack.js"&gt;&lt;/script&gt;
&lt;script src="assets/fancybox/jquery.fancybox-1.3.4.pack.js"&gt;&lt;/script&gt;
&lt;script src="assets/webcam/webcam.js"&gt;&lt;/script&gt;
&lt;script src="assets/js/script.js"&gt;&lt;/script&gt;

&lt;/body&gt;
&lt;/html&gt;</pre>
<p>There are three main divs in the page:</p>
<ul>
<li><strong>#topBar</strong> displays the headings;</li>
<li><strong>#photos</strong> is where the images are inserted after they are requested with jQuery&#8217;s $.getJSON method;</li>
<li><strong>#camera</strong> holds the webcam.swf movie (which we are using to communicate with the web camera). It also holds the control buttons for taking photos and uploading.</li>
</ul>
<p>The control buttons are divided in two <code>.buttonPane</code> divs. In the jQuery part of the tutorial, we will be making a simple function to toggle between the panes.</p>
<p>At the bottom of the body, we are including a number of JavaScript files. Starting with the jQuery library, we are also adding the <a href="http://fancybox.net/" target="_blank">fancybox plugin</a> for displaying the photos, the <a href="http://gsgd.co.uk/sandbox/jquery/easing/" target="_blank">easing plugin</a> (to make fancybox even fancier),  <a href="http://code.google.com/p/jpegcam/">webcam.js</a> &#8211; the plugin that enables us to communicate with web cameras through flash, and finally our own <strong>script.js</strong> to make all this work together.</p>
<p>Note that if you are tweaking your website for high load, you might want to combine all these JS files together. This will make the page load faster as JavaScript files block the page while loading.</p>
<div><a href="http://demo.tutorialzine.com/2011/04/jquery-webcam-photobooth/"><img class="size-full wp-image-1425" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/ee82b_jquery-php-css3-photobooth.jpg" alt="jQuery, CSS3 &amp; PHP Photobooth" width="620" height="460" /></a>
<p>jQuery, CSS3 &amp; PHP Photobooth</p>
</div>
<h3>PHP</h3>
<p>Although the main page is plain old HTML, we do need PHP to make our photo booth work. To be more exact, there are two features of the app that we need PHP for &#8211; receiving the uploaded image from flash, and for listing the uploaded files.</p>
<h4>upload.php</h4>
<pre>/*
	This file receives the JPEG snapshot from
	assets/webcam/webcam.swf as a POST request.
*/

// We only need to handle POST requests:
if(strtolower($_SERVER['REQUEST_METHOD']) != 'post'){
	exit;
}

$folder = 'uploads/';
$filename = md5($_SERVER['REMOTE_ADDR'].rand()).'.jpg';

$original = $folder.$filename;

// The JPEG snapshot is sent as raw input:
$input = file_get_contents('php://input');

if(md5($input) == '7d4df9cc423720b7f1f3d672b89362be'){
	// Blank image. We don't need this one.
	exit;
}

$result = file_put_contents($original, $input);
if (!$result) {
	echo '{
		"error"		: 1,
		"message"	: "Failed save the image. Make sure you chmod the uploads folder and its subfolders to 777."
	}';
	exit;
}

$info = getimagesize($original);
if($info['mime'] != 'image/jpeg'){
	unlink($original);
	exit;
}

// Moving the temporary file to the originals folder:
rename($original,'uploads/original/'.$filename);
$original = 'uploads/original/'.$filename;

// Using the GD library to resize
// the image into a thumbnail:

$origImage	= imagecreatefromjpeg($original);
$newImage	= imagecreatetruecolor(154,110);
imagecopyresampled($newImage,$origImage,0,0,0,0,154,110,520,370); 

imagejpeg($newImage,'uploads/thumbs/'.$filename);

echo '{"status":1,"message":"Success!","filename":"'.$filename.'"}';</pre>
<p>As I mentioned earlier, we can&#8217;t communicate with web cameras directly from JavaScript. This is why we need flash, which has excellent web camera support, to act as an intermediate layer. This leaves us with two choices:</p>
<ul>
<li>we can have flash export the snapshot and make it available to JavaScript (slow and ineffective);</li>
<li>have flash upload the photo directly to a PHP script.</li>
</ul>
<p>Sensibly, the flash webcam plugin uses the second approach. It also has the benefit of uploading the snapshot as a valid JPEG image, which means we can save it to a file directly with PHP, without having to convert it.</p>
<p>In our <em>upload.php</em> we validate that the uploaded data is a JPEG image, save it to a file in the <em><strong>uploads/original/</strong></em> directory, and generate a 154 -by- 110 px thumbnail. I chose this thumbnail size out of convenience, as it shares the same width to height ratio as the original image (520 -by- 370 px), which makes the resize easier.</p>
<div><a href="http://demo.tutorialzine.com/2011/04/jquery-webcam-photobooth/"><img class="size-full wp-image-1426" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/5b40d_webcam-shot-flash-jquery-php-css3.jpg" alt="Take a photo - Webcam Photobooth" width="620" height="460" /></a>
<p>Take a photo &#8211; Webcam Photobooth</p>
</div>
<h4>browse.php</h4>
<pre>/*
	In this file we are scanning the image folders and
	returning a JSON object with file names. It is used
	by jQuery to display the images on the main page:
*/

// The standard header for json data:
header('Content-type: application/json');

$perPage = 24;

// Scanning the thumbnail folder for JPG images:
$g = glob('uploads/thumbs/*.jpg');

if(!$g){
	$g = array();
}

$names = array();
$modified = array();

// We loop though the file names returned by glob,
// and we populate a second file with modifed timestamps.

for($i=0,$z=count($g);$i&lt;$z;$i++){
	$path = explode('/',$g[$i]);
	$names[$i] = array_pop($path);

	$modified[$i] = filemtime($g[$i]);
}

// Multisort will sort the array with the filenames
// according to their timestamps, given in $modified:

array_multisort($modified,SORT_DESC,$names);

$start = 0;

// browse.php can also paginate results with an optional
// GET parameter with the filename of the image to start from:

if(isset($_GET['start']) &amp;&amp; strlen($_GET['start'])&gt;1){
	$start = array_search($_GET['start'],$names);

	if($start === false){
		// Such a picture was not found
		$start = 0;
	}
}

// nextStart is returned alongside the filenames,
// so the script can pass it as a $_GET['start']
// parameter to this script if "Load More" is clicked

$nextStart = '';

if($names[$start+$perPage]){
	$nextStart = $names[$start+$perPage];
}

$names = array_slice($names,$start,$perPage);

// Formatting and returning the JSON object:

echo json_encode(array(
	'files' =&gt; $names,
	'nextStart'	=&gt; $nextStart
));</pre>
<p>The <em><strong>browse.php</strong></em> file lists the contents of the image folders as a JSON object. It does it with <a href="http://php.net/manual/en/function.glob.php" target="_blank">PHP&#8217;s glob function</a>, which scans the folder and returns an array with file names. We then sort this array according to the photo upload dates with the <a href="http://php.net/manual/en/function.array-multisort.php" target="_blank">array_multisort</a> function, after which we slice it with <a href="http://bg.php.net/manual/en/function.array-slice.php" target="_blank">array_slice</a> to return only 24 photos at a time.</p>
<h3>jQuery</h3>
<p>As I mentioned earlier, we are using the webcam.js plugin to control the user&#8217;s web camera. This plugin exposes a <a href="http://code.google.com/p/jpegcam/wiki/APIDocs" target="_blank">simple API</a>, available as a global object named <em>webcam</em>. It gives us methods for taking and uploading photos, and for generating the necessary embed code for the swf file.</p>
<p>In script.js below, we will be using this api and build our photo booth script around it. First we will define some variables and cache the most commonly used jQuery selectors throughout the code for better performance:</p>
<h4>assets/js/script.js &#8211; Part 1</h4>
<pre>$(document).ready(function(){

	var camera = $('#camera'),
		photos = $('#photos'),
		screen =  $('#screen');

	var template = '&lt;a href="uploads/original/{src}" rel="cam" '
		+'style="background-image:url(uploads/thumbs/{src})"&gt;&lt;/a&gt;';

	/*----------------------------------
		Setting up the web camera
	----------------------------------*/

	webcam.set_swf_url('assets/webcam/webcam.swf');
	webcam.set_api_url('upload.php');	// The upload script
	webcam.set_quality(80);				// JPEG Photo Quality
	webcam.set_shutter_sound(true, 'assets/webcam/shutter.mp3');

	// Generating the embed code and adding it to the page:
	screen.html(
		webcam.get_html(screen.width(), screen.height())
	);</pre>
<p>The <code>template</code> variable above holds the markup that will be generated for each photo. It is basically a hyperlink that has the thumbnail of the photo as its background-image, and which points to the full size shot. The <code>{src}</code> attribute gets replaced with the actual file name of the photo (the file names were generated automatically by <strong>upload.php</strong> in the previous section).</p>
<p>Next we will be binding event listeners for the control buttons. Notice the use of <strong>webcam.freeze()</strong>, and the <strong>webcam.upload()</strong> methods. This gives the user the ability to take a shot and decide whether to upload it later. <strong>webcam.reset()</strong> prepares the web camera for another shot.</p>
<h4>assets/js/script.js &#8211; Part 2</h4>
<pre>	/*----------------------------------
		Binding event listeners
	----------------------------------*/

	var shootEnabled = false;

	$('#shootButton').click(function(){

		if(!shootEnabled){
			return false;
		}

		webcam.freeze();
		togglePane();
		return false;
	});

	$('#cancelButton').click(function(){
		webcam.reset();
		togglePane();
		return false;
	});

	$('#uploadButton').click(function(){
		webcam.upload();
		webcam.reset();
		togglePane();
		return false;
	});

	camera.find('.settings').click(function(){
		if(!shootEnabled){
			return false;
		}

		webcam.configure('camera');
	});

	// Showing and hiding the camera panel:

	var shown = false;
	$('.camTop').click(function(){

		$('.tooltip').fadeOut('fast');

		if(shown){
			camera.animate({
				bottom:-466
			});
		}
		else {
			camera.animate({
				bottom:-5
			},{easing:'easeOutExpo',duration:'slow'});
		}

		shown = !shown;
	});

	$('.tooltip').mouseenter(function(){
		$(this).fadeOut('fast');
	});</pre>
<p>After this we will need to implement some of the callbacks exposed by the webcam plugin:</p>
<h4>assets/js/script.js &#8211; Part 3</h4>
<pre>	/*----------------------
		Callbacks
	----------------------*/

	webcam.set_hook('onLoad',function(){
		// When the flash loads, enable
		// the Shoot and settings buttons:
		shootEnabled = true;
	});

	webcam.set_hook('onComplete', function(msg){

		// This response is returned by upload.php
		// and it holds the name of the image in a
		// JSON object format:

		msg = $.parseJSON(msg);

		if(msg.error){
			alert(msg.message);
		}
		else {
			// Adding it to the page;
			photos.prepend(templateReplace(template,{src:msg.filename}));
			initFancyBox();
		}
	});

	webcam.set_hook('onError',function(e){
		screen.html(e);
	});</pre>
<p>This completes the web camera integration. However we still need to display a list with the latest photos (and give users a way to browse through older images as well). We will be doing this with a custom function called <code>loadPics()</code> which will communicate with <em><strong>browse.php</strong></em>:</p>
<h4>assets/js/script.js &#8211; Part 4</h4>
<pre>	/*-------------------------------------
		Populating the page with images
	-------------------------------------*/

	var start = '';

	function loadPics(){

		// This is true when loadPics is called
		// as an event handler for the LoadMore button:

		if(this != window){
			if($(this).html() == 'Loading..'){
				// Preventing more than one click
				return false;
			}
			$(this).html('Loading..');
		}

		// Issuing an AJAX request. The start parameter
		// is either empty or holds the name of the first
		// image to be displayed. Useful for pagination:

		$.getJSON('browse.php',{'start':start},function(r){

			photos.find('a').show();
			var loadMore = $('#loadMore').detach();

			if(!loadMore.length){
				loadMore = $('&lt;span&gt;',{
					id			: 'loadMore',
					html		: 'Load More',
					click		: loadPics
				});
			}

			$.each(r.files,function(i,filename){
				photos.append(templateReplace(template,{src:filename}));
			});

			// If there is a next page with images:
			if(r.nextStart){

				// r.nextStart holds the name of the image
				// that comes after the last one shown currently.

				start = r.nextStart;
				photos.find('a:last').hide();
				photos.append(loadMore.html('Load More'));
			}

			// We have to re-initialize fancybox every
			// time we add new photos to the page:

			initFancyBox();
		});

		return false;
	}

	// Automatically calling loadPics to
	// populate the page onload:

	loadPics();</pre>
<p>As <code>loadPics()</code> is bound as a handler for the <em>click</em> event of the <em><strong>Load More</strong></em> tile, this function can be called in two ways: the normal one and as a callback. The difference is that the <code>this</code> object of the function points either to <code>window</code>, or to the DOM element. We can check for this and take appropriate action, like preventing double clicks from issuing multiple requests to browse.php.</p>
<p>Lastly, we have the helper functions, used throughout the rest of the code.</p>
<h4>assets/js/script.js &#8211; Part 5</h4>
<pre>	/*----------------------
		Helper functions
	------------------------*/

	// This function initializes the
	// fancybox lightbox script.

	function initFancyBox(filename){
		photos.find('a:visible').fancybox({
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic',
			'overlayColor'	: '#111'
		});
	}

	// This function toggles the two
	// .buttonPane divs into visibility:

	function togglePane(){
		var visible = $('#camera .buttonPane:visible:first');
		var hidden = $('#camera .buttonPane:hidden:first');

		visible.fadeOut('fast',function(){
			hidden.show();
		});
	}

	// Helper function for replacing "{KEYWORD}" with
	// the respectful values of an object:

	function templateReplace(template,data){
		return template.replace(/{([^}]+)}/g,function(match,group){
			return data[group.toLowerCase()];
		});
	}
});</pre>
<p>Now that we&#8217;ve discussed all of the code, lets say a few words about the CSS styles.</p>
<h3>CSS3</h3>
<p>With the recent introduction of Firefox 4, CSS3 transitions can finally become a fully qualified member of our developer toolbox. In our photobooth, we are using CSS3 to add a bit of class to the photo booth.</p>
<h4>assets/css/styles.css</h4>
<pre>/*-------------------
	Photo area
--------------------*/

#photos{
	margin: 60px auto 100px;
	overflow: hidden;
	width: 880px;
}

#photos:hover a{
	opacity:0.5;
}

#photos a,
#loadMore{
	background-position: center center;
	background-color: rgba(14, 14, 14, 0.3);
	float: left;
	height: 110px;
	margin: 1px 1px 0 0;
	overflow: hidden;
	width: 145px;

	-moz-transition:0.25s;
	-webkit-transition:0.25s;
	-o-transition:0.25s;
	transition:0.25s;
}

#photos a:hover{
	opacity:1;
}

#loadMore{
	cursor: pointer;
	line-height: 110px;
	text-align: center;
	text-transform: uppercase;
	font-size:10px;
}

#loadMore:hover{
	color:#fff;
	text-shadow:0 0 4px #fff;
}</pre>
<p>In the fragment above, you can see that we&#8217;ve defined a 0.25s transition on the photo anchors (these hold our images). This will animate every change to the styles of these elements, including those applied by <em>:hover</em> definitions. This in effect makes all the photos fade out to 50% when we hover over the <strong>#photos</strong> div, except the one directly beneath the mouse pointer.</p>
<p>With that same transition definition, we also affect the #loadMore span. It has a text shadow rule applied on hover, which gets animated into a smooth glow effect.</p>
<div><a href="http://demo.tutorialzine.com/2011/04/jquery-webcam-photobooth/"><img class="size-full wp-image-1427" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/5b40d_jquery-photobooth-hover.jpg" alt="CSS3 Effects" width="620" height="260" /></a>
<p>CSS3 Effects</p>
</div>
<p><strong>With this our photo booth is complete!</strong></p>
<h3>Conclusion</h3>
<p>You can use this app as a fun addition to a community forum or other social networking website. You can optionally build in a comment field to go with the photo, or integrate it more deeply with your site.</p>
<p>Did you like this week&#8217;s tutorial? Share you thoughts in the comment section.</p>
<div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/86ca1_7dvUHHZAPKg" height="1" width="1" /></p>
<p><a href="http://feeds.feedburner.com/Tutorialzine">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/tutorial/photobooth-with-php-jquery-and-css3/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>How to Create Social Media Buttons Using CSS3</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/how-to-create-social-media-buttons-using-css3/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/how-to-create-social-media-buttons-using-css3/#comments</comments>
		<pubDate>Wed, 29 Dec 2010 16:24:07 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[web resources]]></category>
		<category><![CDATA[div class]]></category>
		<category><![CDATA[e mail]]></category>
		<category><![CDATA[faceboo]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[graphics editors]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[social networking]]></category>
		<category><![CDATA[span class]]></category>
		<category><![CDATA[span elements]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/how-to-create-social-media-buttons-using-css3/</guid>
		<description><![CDATA[CSS3 is truly amazing. It gives web designers the ability to create flexible and easily reusable design elements, and reduces our reliance on images and graphics editors. This is a guide shows you how to create stylish social media buttons using CSS3, HTML, and some freely available social media icons. View Demo 1: Inset Buttons [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://sixrevisions.com/css/how-to-create-social-media-buttons-using-css3/"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/63ab0_21-01_css3_social_media_buttons_ld_img.jpg" width="550" height="200" alt="How to Create Social Media Buttons Using CSS3" /></a></p>
<p><a href="http://sixrevisions.com/css/css3-techniques-you-should-know/" title="CSS3 Techniques You Should Know - sixrevisions.com">CSS3</a> is truly amazing. It gives web designers the ability to create flexible and easily reusable design elements, and reduces our reliance on images and graphics editors. This is a guide shows you how to create stylish social media buttons using CSS3, HTML, and some freely available social media icons.</p>
<p><span></span></p>
<ul>
<li><a href="http://demos.sixrevisions.com/0002_css3_social_media_buttons/demos/inset_social_media_buttons.html">View Demo 1: Inset Buttons</a></li>
<li><a href="http://demos.sixrevisions.com/0002_css3_social_media_buttons/demos/outset_social_media_buttons.html">View Demo 2: Outset Buttons</a></li>
<li><a href="http://demos.sixrevisions.com/0002_css3_social_media_buttons/downloads/css3_social_media_buttons.zip">Download Source</a></li>
</ul>
<h3>Inspiration</h3>
<p>One day, I stumbled upon Louis Harboe&#8217;s personal website, <a href="http://graphicpeel.com/">Graphicpeel</a>, and I noticed his simple yet nicely designed social media buttons at the bottom of the site&#8217;s <a href="http://graphicpeel.com/about">About page</a>. I thought to myself, <em>these are nice but I bet I could do this using just CSS3</em>. And off I went!</p>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/4cb74_21-07_css3_social_media_buttons_inspiration.jpg" width="550" height="605" alt="Inspiration" /></p>
<h3>HTML</h3>
<p>First off, we will set the foundations with some simple HTML. We want to create a <code>div</code> that will contain our buttons and that has a class name of <code>inset</code>. Then we want use an unordered list (<code>&lt;ul&gt;</code>), with each button being a list item (<code>&lt;li&gt;</code>).</p>
<p>Inside each <code>&lt;li&gt;</code> tag, we will have a link (<code>&lt;a&gt;</code>). Each link will have an <code>&lt;img&gt;</code> inside it that represents the social media icon, as well as a <code>&lt;span&gt;</code> to hold the text for the button (which will be &quot;LinkedIn&quot;, &quot;Facebook&quot;, and so forth). The social media icons I used are from <a href="http://www.jankoatwarpspeed.com/post/2009/02/23/Handycons-2-another-free-hand-drawn-icon-set.aspx">Handycons 2</a> and <a href="http://webtreats.mysitemyway.com/108-free-matte-white-square-social-networking-icons/">108 Free Matte White Square Social Networking Icons.</a></p>
<p>We can give the <code>span</code> elements a class name of <code>site</code> to be able to style them later on.</p>
<p>Your HTML should look something like the following:</p>
<pre>
&lt;div <strong>class="inset"</strong>&gt;
 &lt;ul&gt;
  &lt;li&gt;
   &lt;a href="mailto:ansarob@gmail.com"&gt;
    &lt;img src="images/gmail_16.png" alt="gmail icon" /&gt;
    &lt;span <strong>class="site"</strong>&gt;E-Mail&lt;/span&gt;
   &lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
   &lt;a href="http://linkedin.com" title="My LinkedIn Page"&gt;
    &lt;img src="images/linkedin_16.png" alt="LinkedIn icon" /&gt;
    &lt;span <strong>class="site"</strong>&gt;LinkedIn&lt;/span&gt;
   &lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
   &lt;a href="http://facebook.com" title="My Facebook Page"&gt;
    &lt;img src="images/facebook_16.png" alt="Facebook icon" /&gt;
    &lt;span <strong>class="site"</strong>&gt;Facebook&lt;/span&gt;
   &lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
   &lt;a href="http://twitter.com" title="My Twitter Page"&gt;
    &lt;img src="images/twitter_16.png" alt="Twitter icon" /&gt;
    &lt;span <strong>class="site"</strong>&gt;Twitter&lt;/span&gt;
   &lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
   &lt;a href="http://flickr.com" title="My Flickr Page"&gt;
    &lt;img src="images/flickr_16.png" alt="Flickr icon" /&gt;
    &lt;span <strong>class="site"</strong>&gt;Flickr&lt;/span&gt;
   &lt;/a&gt;
  &lt;/li&gt;
 &lt;/ul&gt;
&lt;/div&gt;
</pre>
<h3>CSS</h3>
<p>The bulk of the code will be in CSS. We&#8217;ll go over the basic style rules first, and then progressively build up our buttons.</p>
<h4>Basic CSS</h4>
<p>Let us give our buttons some basic styles. The following code block simply uses CSS2 specs, which will give us a good fallback for browsers that don&#8217;t have support for CSS3 specifications (progressive enhancement).</p>
<p>The following is pretty self-explanatory: We just style the list items so that they appear to look like boxy buttons that are laid out side by side (using <code>display:block</code> and <code>float:left</code>).</p>
<pre>
.inset {
  font-family: Helvetica, Verdana, Arial, sans-serif;
  font-size: 14px;
  list-style-type: none;
  margin: 10px 0 0 10px;
}

.inset ul { list-style-type: none; display: block; }

.inset li {
  float: left;
  height: 30px;
  margin: 0 8px 7px 0;
}

.inset li a {
  background-color: gray;
  color: #424242;
  float: left;
  font-size: 16px;
  font-weight: bold;
  height: 24px;
  padding-left: 27px;
  padding-top: 6px;
  position: relative;
  text-decoration: none;
  border: 1px solid #bfc1c6;
}

.inset li a:hover {
  border: 1px solid #b4b7bb;
}

.inset li a img {
  height: 16px;
  left: 7px;
  margin-right: 7px;
  position: absolute;
  top: 7px;
  width: 16px;
    border: none;
}

.inset li a span {
  display: block;
  height: 22px;
  padding-right: 7px;
  overflow: hidden;
  <strong>/* width: 70px; Uncomment this to add a fixed width */</strong>
}

span.site { font-size: 14px; line-height: 20px; }</pre>
<p>What we have so far is pretty boring; but that&#8217;s to be expected since we haven&#8217;t used any CSS3 yet.</p>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/ec3d5_21-02_css3_social_media_buttons_ccss2_basic.jpg" width="476" height="56" /></p>
<h4>Rounded Corners with CSS3</h4>
<p>To make these buttons look a bit more stylish, let&#8217;s give them some rounded corners using the <code>border-radius</code> property. Keep in mind that we must use vendor specific browser extensions for Mozilla (<code>-moz-</code> for browsers such as Firefox, SeaMonkey, and Flock) and WebKit (<code>-webkit-</code> for browsers such as Safari and Chrome). Other browsers such as Opera and <a href="http://sixrevisions.com/web-development/five-things-ie9-is-actually-doing-right/" title="Five Things IE9 is (Actually) Doing Right - sixrevisions.com">IE9</a> will recognize the <code>border-radius</code> property without vendor prefixes.</p>
<p>Add these properties to the <code>.inset li a</code> selector:</p>
<pre>
<strong>/* Mozilla browsers that use Gecko layout engine */</strong>
-moz-border-radius: 5px;
<strong>/* Safari and Chrome that use WebKit layout engine */</strong>
-webkit-borer-radius: 5px;
<strong>/* W3C CSS Level 3.0 specifications. For Opera and IE9 */</strong>
border-radius: 5px;</pre>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/53f93_21-03_css3_social_media_buttons_ccss3_rounded_corners.jpg" width="476" height="56" /></p>
<h4>Color Gradients with CSS3</h4>
<p>With CSS3 gradients, we can do some pretty cool stuff that otherwise would need to be done with CSS background images created in a graphics editor like <a href="http://sixrevisions.com/category/photoshop/">Photoshop</a>. CSS3 gradients allow us to add color gradients to any HTML element that can result in many interesting things such as <a href="http://css3wizardry.com/2010/08/19/css3-gradients-and-patterns/" title="CSS3 Gradients and Patterns - css3wizardry.com">CSS3 design patterns</a> and illustrative renderings such as <a href="http://sixrevisions.com/css/how-to-create-css3-christmas-tree-ornaments/" title="How to Create CSS3 Christmas Tree Ornaments - sixrevisions.com">Christmas baubles</a>.</p>
<p>To create the gradient on our buttons, we will use the gradient value syntax (i.e. <code>linear-gradient()</code> and <code>gradient()</code>) assigned to the <code>background</code> property.</p>
<p>The implementation for Mozilla browsers and WebKit browsers is different, so although we&#8217;re trying to do the same thing, the code will be different for each browser layout engine.</p>
<p>Notice that for Mozilla (<code>-moz-</code>), I have used percentages, whereas for WebKit (<code>-webkit-</code>) I have to use decimals; 1% in Mozilla is .01 in WebKit, 10% in Mozilla is equivalent to .10 in WebKit, and so on.</p>
<p>Add these styles to the <code>.inset li a</code> selector:</p>
<pre>
<strong>/* Mozilla browsers that use Gecko layout engine */</strong>
background: -moz-linear-gradient(#a5a7aa, #bec1c5 1%, #d8dbdf 10%, #d8dbdf);
<strong>/* Safari and Chrome that use WebKit layout engine */</strong>
background: -webkit-gradient(linear,left top,left bottom,color-stop(0, #a5a7aa),color-stop(.01, #bec1c5),color-stop(.10, #d8dbdf),color-stop(1, #d8dbdf));</pre>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/9d942_21-04_css3_social_media_buttons_css3_gradients.jpg" width="476" height="56" alt="" /></p>
<h4>Styling the :hover Pseudo-class</h4>
<p>Let&#8217;s go ahead and change the way the buttons look when the user hovers over them. By changing up the gradient colors slightly when a user mouses over one of the buttons, we can give her a visual cue that it is clickable. If you wanted to make these even more visually-engaging, you may want to experiment with CSS3 <code>transform</code> functions.</p>
<p>Add these styles to the <code>.inset li a:hover</code> selector:</p>
<pre>
background: -moz-linear-gradient(#9c9fa2, #b4b7bb 1%, #cdd0d5 10%, #cdd0d5);
background: -webkit-gradient(linear,left top,left bottom,color-stop(0, #9c9fa2),color-stop(.01, #b4b7bb),color-stop(.10, #cdd0d5),color-stop(1, #cdd0d5));</pre>
<p>In the image below, I&#8217;ve hovered over the <em>E-mail</em> button. As you can see, it is slightly darker than the others.</p>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/193ab_21-05_css3_social_media_buttons_hover_psuedo-class.jpg" width="476" height="56" alt="&lt;pre&gt;" /></p>
<h3>Alternative Result: &quot;Outset&quot; Buttons with Different Colors</h3>
<p>To demonstrate the flexibility that CSS3 offers, let us create a different version of the buttons using the same HTML structure.</p>
<h4>HTML</h4>
<p>In this example, we need to change the class of the containing <code>div</code> from <code>inset</code> to <code>outset-colored</code>.</p>
<p>Additionally, since each button will be a different color, we must also give them a unique class. We can assign these classes to the <code>&lt;a&gt;</code> tags; for example, Facebook will have <code>class=&quot;facebook&quot;</code>. You&#8217;re probably wondering why I chose to use the class attribute versus the ID attribute: It&#8217;s because I want to account for the situation that multiple buttons of the same class can appear on the same page.</p>
<p>Here is the HTML:</p>
<pre>
&lt;div <strong>class=&quot;outset-colored&quot;</strong>&gt;
  &lt;ul&gt;
    &lt;li&gt;
      &lt;a href=&quot;mailto:ansarob@gmail.com&quot; title=&quot;My E-Mail&quot; <strong>class=&quot;email&quot;</strong>&gt;
        &lt;img src=&quot;images/gmail_white.png&quot; alt=&quot;gmail icon&quot; /&gt;
        &lt;span class=&quot;site&quot;&gt;E-Mail&lt;/span&gt;
      &lt;/a&gt;
    &lt;/li&gt;
    &lt;li&gt;
      &lt;a href=&quot;http://linkedin.com&quot; title=&quot;My LinkedIn Page&quot; <strong>class=&quot;linkedin&quot;</strong>&gt;
        &lt;img src=&quot;images/linkedin_white.png&quot; alt=&quot;LinkedIn icon&quot; /&gt;
        &lt;span class=&quot;site&quot;&gt;LinkedIn&lt;/span&gt;
      &lt;/a&gt;
    &lt;/li&gt;
    &lt;li&gt;
      &lt;a href=&quot;http://facebook.com&quot; title=&quot;My Facebook Page&quot; <strong>class=&quot;facebook&quot;</strong>&gt;
        &lt;img src=&quot;images/facebook_white.png&quot; alt=&quot;Facebook icon&quot; /&gt;
        &lt;span class=&quot;site&quot;&gt;Facebook&lt;/span&gt;
      &lt;/a&gt;
    &lt;/li&gt;
    &lt;li&gt;
      &lt;a href=&quot;http://twitter.com&quot; title=&quot;My Twitter Page&quot; <strong>class=&quot;twitter&quot;</strong>&gt;
        &lt;img src=&quot;images/twitter_white.png&quot; alt=&quot;Twitter icon&quot; /&gt;
        &lt;span class=&quot;site&quot;&gt;Twitter&lt;/span&gt;
      &lt;/a&gt;
    &lt;/li&gt;
    &lt;li&gt;
      &lt;a href=&quot;http://flickr.com&quot; title=&quot;My Flickr Page&quot; <strong>class=&quot;flickr&quot;</strong>&gt;
        &lt;img src=&quot;images/flickr_white.png&quot; alt=&quot;Flickr icon&quot; /&gt;
        &lt;span class=&quot;site&quot;&gt;Flickr&lt;/span&gt;
      &lt;/a&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
&lt;/div&gt;
</pre>
<h4>CSS</h4>
<p>The CSS is lengthier than the original, but that&#8217;s because each button has a different color. The CSS3 used is very similar; the alternative result just has different color values for the gradients.</p>
<p>Here is the CSS for the alternative result:</p>
<pre>
<strong>/* COLORED OUTSET BUTTONS */</strong>

.outset-colored {
  font-family: Helvetica, Verdana, Arial, sans-serif;
  font-size: 14px;
  list-style-type: none;
  margin: 10px 0 0 10px;
}

.outset-colored ul { list-style-type: none; display: block; }

.outset-colored li {
  float: left;
  height: 30px;
  margin: 0 8px 7px 0;
}

.outset-colored li a {
  color: #424242;
  float: left;
  font-size: 16px;
  font-weight: bold;
  height: 24px;
  padding-left: 27px;
  padding-top: 6px;
  position: relative;
  text-decoration: none;
  border: 1px solid #bfc1c6;
  border-radius: 5px;
  background-color: #D8D9DD;
  -moz-border-radius: 5px;
  -webkit-borer-radius: 5px;
}
<strong>
/* EMAIL */</strong>
.outset-colored li a.email {
  background: -moz-linear-gradient(#ff6666, #cc0000 10%, #c40202);
  background: -webkit-gradient(linear,left top,left bottom,color-stop(0, #ff6666),color-stop(.10, #cc0000),color-stop(1, #c40202));
  color: #f3f3f3;
  border: 1px solid #c40202;
}

.outset-colored li a:hover.email {
  background: -moz-linear-gradient(#c40202, #cc0000 1%, #e03434 10%, #e03434);
  background: -webkit-gradient(linear,left top,left bottom,color-stop(0, #c40202),color-stop(.01, #cc0000),color-stop(.10, #e03434),color-stop(1, #e03434));
}

<strong>/* LINKEDIN */</strong>
.outset-colored li a.linkedin {
  background: -moz-linear-gradient(#7cd0fb, #38a5dc 10%, #2c83ae);
  background: -webkit-gradient(linear,left top,left bottom,color-stop(0, #7cd0fb),color-stop(.10, #38a5dc),color-stop(1, #2c83ae));
  color: #f3f3f3;
  border: 1px solid #2c83ae;
}

.outset-colored li a:hover.linkedin {
  background: -moz-linear-gradient(#2c83ae, #38a5dc 1%, #41b9f6 10%, #41b9f6);
  background: -webkit-gradient(linear,left top,left bottom,color-stop(0, #2c83ae),color-stop(.01, #38a5dc),color-stop(.10, #41b9f6),color-stop(1, #41b9f6));
}

<strong>/* FACEBOOK */</strong>
.outset-colored li a.facebook {
  background: -moz-linear-gradient(#7aa3f7, #4c72c3 10%, #3b5998);
  background: -webkit-gradient(linear,left top,left bottom,color-stop(0, #7aa3f7),color-stop(.10, #4c72c3),color-stop(1, #3b5998));
  color: #f3f3f3;
  border: 1px solid #3b5998;
}

.outset-colored li a:hover.facebook {
  background: -moz-linear-gradient(#3b5998, #4c72c3 1%, #5c8aea 10%, #5c8aea);
  background: -webkit-gradient(linear,left top,left bottom,color-stop(0, #3b5998),color-stop(.01, #4c72c3),color-stop(.10, #5c8aea),color-stop(1, #5c8aea));
}

<strong>/* TWITTER */</strong>
.outset-colored li a.twitter {
  background: -moz-linear-gradient(#8ae0fd, #24bce6 10%, #1e9ec1);
  background: -webkit-gradient(linear,left top,left bottom,color-stop(0, #8ae0fd),color-stop(.10, #24bce6),color-stop(1, #1e9ec1));
  color: #f3f3f3;
  border: 1px solid #1e9ec1;
}

.outset-colored li a:hover.twitter {
  background: -moz-linear-gradient(#1e9ec1, #24bce6 1%, #33ccff 10%, #33ccff);
  background: -webkit-gradient(linear,left top,left bottom,color-stop(0, #24bce6),color-stop(.01, #33ccff),color-stop(.10, #33ccff),color-stop(1, #33ccff));
}

<strong>/* FLICKR */</strong>
.outset-colored li a.flickr {
  background: -moz-linear-gradient(#fc75ba, #e10374 10%, #c10263);
  background: -webkit-gradient(linear,left top,left bottom,color-stop(0, #fc75ba),color-stop(.10, #e10374),color-stop(1, #c10263));
  color: #f3f3f3;
  border: 1px solid #c10263;
}

.outset-colored li a:hover.flickr {
  background: -moz-linear-gradient(#c10263, #e10374 1%, #ff0283 10%, #ff0283);
  background: -webkit-gradient(linear,left top,left bottom,color-stop(0, #c10263),color-stop(.01, #e10374),color-stop(.10, #ff0283),color-stop(1, #ff0283));
}

.outset-colored li a img {
  height: 16px;
  left: 7px;
  margin-right: 7px;
  position: absolute;
  top: 7px;
  width: 16px;
   border: none;
}

.outset-colored li a span {
  display: block;
  height: 22px;
  padding-right: 7px;
  overflow: hidden;
  <strong>/*width: 70px; Add a width here if you want all the buttons to be the same size.*/</strong>
}

span.site { font-size: 14px; line-height: 20px; }
</pre>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/4db03_21-06_css3_social_media_buttons_outset_colored.jpg" width="476" height="56" alt="" />
</p>
<h3>Related Content</h3>
<ul>
<li><a href="http://sixrevisions.com/css/create-a-css3-call-to-action-button/">Create a CSS3 Call to Action Button</a></li>
<li><a href="http://sixrevisions.com/css/semantic-css3-lightboxes/">Semantic CSS3 Lightboxes</a></li>
<li><a href="http://sixrevisions.com/css/how-to-create-css3-christmas-tree-ornaments/">How to Create CSS3 Christmas Tree Ornaments</a></li>
<li><em>Related categories</em>: <a href="http://sixrevisions.com/category/css/">CSS</a> and <a href="http://sixrevisions.com/category/web_design/">Web Design</a></li>
</ul>
<h3>About the Author</h3>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/620a2_andrew_roberts_small.jpg" alt="" width="80" height="80" /><strong>Andrew Roberts</strong> is a Christian with a passion for web design and development. His web interests focus mostly on HTML/CSS, JavaScript, &amp; PHP/MySQL. When he&#8217;s not glued to the computer, he&#8217;s spending time with his girlfriend Kaitlynn, <a href="http://www.flickr.com/photos/zoonino">photographing animals</a>, or reading. His goal is to attend graduate school for Biblical Studies &amp; Ministry.</p>
<div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/2797e_4RR79OBLUr0" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/SixRevisions">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/how-to-create-social-media-buttons-using-css3/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Charming Lettering With jQuery – Lettering.js</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/charming-lettering-with-jquery-%e2%80%93-lettering-js/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/charming-lettering-with-jquery-%e2%80%93-lettering-js/#comments</comments>
		<pubDate>Sat, 30 Oct 2010 14:20:05 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[web resources]]></category>
		<category><![CDATA[cheap ssl certificates]]></category>
		<category><![CDATA[custom fonts]]></category>
		<category><![CDATA[dynamic drag]]></category>
		<category><![CDATA[fancy title]]></category>
		<category><![CDATA[radical web]]></category>
		<category><![CDATA[smart interface]]></category>
		<category><![CDATA[span class]]></category>
		<category><![CDATA[w lt]]></category>
		<category><![CDATA[web typography]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/charming-lettering-with-jquery-%e2%80%93-lettering-js/</guid>
		<description><![CDATA[CSS3 boosted the use of custom fonts and styles in websites. However, it still doesn&#039;t offer a complete down-to-the-letter control. Lettering.js, a lightweight and easy to use Javascript &#60;span&#62; injector for radical web typography aims to fill this gap. It simply divides any given element into pieces of &#60;span&#62;s wrapping each letter with a custom [...]]]></description>
			<content:encoded><![CDATA[<p>CSS3 boosted the use of custom fonts and styles in websites. However, it still doesn&#039;t offer a complete down-to-the-letter control.</p>
<p><a href="http://letteringjs.com/" target="_blank"><strong>Lettering.js</strong></a>, a lightweight and easy to use Javascript &lt;span&gt; injector for radical web typography aims to fill this gap.</p>
<p><a href="http://letteringjs.com/" target="_blank"><img alt="Lettering.js" height="150" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/a80e0_lettering-js.gif" width="480" /></a></p>
<p>It simply <strong>divides any given element into pieces of &lt;span&gt;s</strong> wrapping each letter with a custom class.</p>
<p>Just like <code>&lt;h1 class=&quot;fancy_title&quot;&gt;WRD&lt;/h1&gt;</code> into:</p>
<p><code>&lt;h1 class=&quot;fancy_title&quot;&gt;<br />
	&nbsp; &lt;span class=&quot;char1&quot;&gt;W&lt;/span&gt;<br />
	&nbsp; &lt;span class=&quot;char2&quot;&gt;R&lt;/span&gt;<br />
	&nbsp; &lt;span class=&quot;char3&quot;&gt;D&lt;/span&gt;<br />
	&lt;/h1&gt; </code></p>
<p>After that, we just need to create the styles for each letter on the CSS side to create dynamic awesome outputs.</p>
<p><strong>P.S.</strong> <strong><a href="http://letteringjs.com/" target="_blank">Lettering.js</a></strong> can also split words besides the letters.</p>
<p><strong>Special Downloads:</strong><br />
<a href="http://www.webresourcesdepot.com/?download=jBasket" target="_blank">Ajaxed Add-To-Basket Scenarios With jQuery And PHP</a><br />
<a href="http://www.webresourcesdepot.com/?download=Free-Admin-Template" target="_blank">Free Admin Template For Web Applications</a><br />
<a href="http://www.webresourcesdepot.com/?download=jQuery-Dynamic-Drag-Drop" target="_blank">jQuery Dynamic Drag&#8217;n Drop</a><br />
<a href="http://www.webresourcesdepot.com/?download=sTwitter-1-0" target="_blank">ScheduledTweets</a></p>
<p><strong>Advertisements:</strong><br />
<a href="http://www.admintemplates.com" target="_blank">Professional XHTML Admin Template ($15 Discount With The Code: WRD.)</a><br />
<a href="http://www.xhtmchop.com" target="_blank">Psd to Xhtml</a><br />
<a href="http://www.sslmatic.com" target="_blank">SSLmatic &#8211; Cheap SSL Certificates (from $19.99/year)</a></p>
<p>	Tags: <a href="http://www.webresourcesdepot.com/tag/javascript/" title="Javascript" rel="tag">Javascript</a></p>
<h4>Related posts</h4>
<ul>
<li><a href="http://www.webresourcesdepot.com/zoom-script-with-a-smart-interface-tjpzoom/" title="Zoom Script With A Smart Interface: TJPzoom (September 4, 2008)">Zoom Script With A Smart Interface: TJPzoom</a></li>
<li><a href="http://www.webresourcesdepot.com/zepto-js-tiny-js-framework-for-mobile-webkit-browsers/" title="Zepto.js – Tiny JS Framework For Mobile WebKit Browsers (October 28, 2010)">Zepto.js &#8211; Tiny JS Framework For Mobile WebKit Browsers</a></li>
<li><a href="http://www.webresourcesdepot.com/yui-slideshow-customizable-and-animated-slideshows/" title="YUI Slideshow: Customizable And Animated Slideshows (August 12, 2009)">YUI Slideshow: Customizable And Animated Slideshows</a></li>
<li><a href="http://www.webresourcesdepot.com/wysiwyg-editor-with-a-file-manager-elrte/" title="WYSIWYG Editor With A File Manager: elRTE (August 29, 2010)">WYSIWYG Editor With A File Manager: elRTE</a></li>
<li><a href="http://www.webresourcesdepot.com/wrap-content-around-images-jqslickwrap/" title="Wrap Content Around Images: jQSlickWrap (November 22, 2009)">Wrap Content Around Images: jQSlickWrap</a></li>
</ul>
<div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/d033b_Hl6xNjd-qcQ" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/webresourcesdepot">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/charming-lettering-with-jquery-%e2%80%93-lettering-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Textile Filter for BBEdit?</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/a-textile-filter-for-bbedit/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/a-textile-filter-for-bbedit/#comments</comments>
		<pubDate>Mon, 11 Oct 2010 21:42:41 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[web resources]]></category>
		<category><![CDATA[application support]]></category>
		<category><![CDATA[business reasons]]></category>
		<category><![CDATA[library application]]></category>
		<category><![CDATA[Markdown]]></category>
		<category><![CDATA[snobbery]]></category>
		<category><![CDATA[span class]]></category>
		<category><![CDATA[support unix]]></category>
		<category><![CDATA[unix support]]></category>
		<category><![CDATA[zip unzip]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/a-textile-filter-for-bbedit/</guid>
		<description><![CDATA[A few days back I tweeted a request for a Textile filter for BBEdit, which is one of those things people have asked for over the years but has never actually appeared. There&#8217;s been a Markdown filter since forever, but since I find myself on Basecamp a lot for business reasons and Basecamp uses Textile [...]]]></description>
			<content:encoded><![CDATA[<p>A few days back I tweeted <a href="http://twitter.com/meyerweb/status/26758063723">a request for a Textile filter for BBEdit</a>, which is one of those things people have asked for over the years but has never actually appeared.  There&#8217;s been a Markdown filter since forever, but since I find myself on Basecamp a lot for business reasons and Basecamp uses Textile I&#8217;d really prefer to stick to one syntax instead of constantly confusing myself by switching between two similar syntaxes.</p>
<p>(And I prefer to use BBEdit because I like it a lot, know it well, and have no compelling reason to switch.  Please take any thoughts of text-editor snobbery or flamewars elsewhere.)</p>
<p>In response, the mighty <a href="http://theodicius.net/">Arlen Walker</a> told me how to install Xcode, the Text::Textile module, and a short Perl script to drop into  <code>~/Library/Application Support/BBEdit/Unix Support/Unix Filters</code>.   I did that, and it all worked, but I was unhappy with the <code>&lt;span class=&quot;caps&quot;&gt;</code> that default Textile litters all over.  I tried to disable it, failed, <a href="http://twitter.com/meyerweb/status/27051385833">tweeted for help,</a> and was contacted by the incredible <a href="http://bradchoate.com/">Brad Choate</a> (who wrote the Text::Textile module!).</p>
<p>The upshot of all this is that Brad not only told me how to disable the <code>span</code>s, but how to convert Textile to a standalone BBEdit filter that, so far as I can tell, shouldn&#8217;t require installation of either Xcode or Text::Textile.  I&#8217;m pretty sure about this, but since I&#8217;ve already installed Text::Textile I can&#8217;t be entirely certain.  Who wants to test it out?</p>
<p>All you have to do is download <code><a href="http://meyerweb.com/eric/tools/bbedit/TextileSA.pl.zip">TextileSA.pl.zip</a></code>, unzip it, and drop the Perl script into <code>~/Library/Application Support/BBEdit/Unix Support/Unix Filters</code>.  Once you do that, it should immediately become available in BBEdit, even if BBEdit is already running.  (At least that&#8217;s what happens in BBEdit 9.x.)  Here&#8217;s a test file to Texile-ize if you&#8217;re so inclined:</p>
<pre><code>h1. Testing the BBEdit Textile filter

This is _awesome_!  &quot;Arlen&quot;:http://theodicius.net/ and &quot;Brad&quot;:http://bradchoate.com/ are the *bomb*.</code></pre>
<p>There&#8217;s a bug at the moment that means double-quote marks don&#8217;t get smart-encoded, but Brad&#8217;s aware of it and plans to fix it.  Also, this does a straight Textile run with nothing disabled, so it will in fact still litter <code>&lt;span class=&quot;caps&quot;&gt;</code> around any sequence of uppercase letters (like those in, say, &#8220;BBEdit&#8221;).  If you can&#8217;t stand that even during testing, open up <code>TextileSA.pl</code> and insert the following <em>after</em> line 2312:</p>
<pre><code>my $css_flags = $textile-&gt;css();
$css_flags-&gt;{'class_caps'} = '';
$textile-&gt;css($css_flags);</code></pre>
<p>If you don&#8217;t mind (or even like) those <code>span</code>s, then of course you can slip that part.</p>
<p>The &#8220;SA&#8221; in <code>TextileSA.pl</code> stands for &#8220;StandAlone&#8221;, by the way.  I&#8217;ll drop that once I&#8217;m sure this actually works and pass it along to the BBEdit gang.</p>
<p><a href="http://meyerweb.com/eric/thoughts/rss2/full">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/a-textile-filter-for-bbedit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create a kick-ass CSS3 progress bar</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-a-kick-ass-css3-progress-bar/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-a-kick-ass-css3-progress-bar/#comments</comments>
		<pubDate>Mon, 11 Oct 2010 16:29:58 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[css styles]]></category>
		<category><![CDATA[div class]]></category>
		<category><![CDATA[div id]]></category>
		<category><![CDATA[doctype html]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[label style]]></category>
		<category><![CDATA[meta charset]]></category>
		<category><![CDATA[progress bar]]></category>
		<category><![CDATA[span class]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-a-kick-ass-css3-progress-bar/</guid>
		<description><![CDATA[Please note: The original CSS3 progress bar shown in this tutorial has been created by Ivan Vanderbyl, which hereby gave me the right to reproduce and document his work. The following tutorial and the demo works best on Chrome and Safari, correctly on Firefox and very badly in Internet Explorer (eh&#8230;I&#8217;m sure you hadn&#8217;t guessed [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Please note:</strong> The original CSS3 progress bar shown in this tutorial has been created by <a href="http://ivanvanderbyl.com/">Ivan Vanderbyl</a>, which hereby gave me the right to reproduce and document his work.<br /> The following tutorial and the demo works best on Chrome and Safari, correctly on Firefox and very badly in Internet Explorer (eh&#8230;I&#8217;m sure you hadn&#8217;t guessed that).</p>
<h2>The Demo</h2>
<p><a href="http://skunkworks.ivanvanderbyl.com/" target="blank"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/236e3_pure-css3-progress-bar.jpg" alt="" /></a><br /> Click on the image to view a live demo. You can also <a href="http://github.com/ivanvanderbyl/ui-progress-bar">get the source on Github</a>.</p>
<h2>Getting ready</h2>
<p>Let&#8217;s start by organizing our work. To achieve the effect of this tutorial, we&#8217;ll need to create 3 files:</p>
<ul>
<li><code>progress.html</code>, which will contain our markup.</li>
<li><code>ui.css</code> which will contain our CSS styles.</li>
<li><code>progress.js</code> which will contain some additional jQuery animations.</li>
</ul>
<p>Create a directory on your webserver (or hard drive) and create the files.</p>
<h2>The HTML markup</h2>
<p>Here we go. Open your <code>progress.html</code> file and paste the following markup in it:</p>
<pre>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
	&lt;meta charset="utf-8"&gt;
	&lt;title&gt;Pure CSS Progress Bar&lt;/title&gt;

	&lt;link rel="stylesheet" href="stylesheets/ui.css"&gt;
	&lt;link rel="stylesheet" href="stylesheets/ui.progress-bar.css"&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;div id="container"&gt;
		&lt;div id="progress_bar" class="ui-progress-bar ui-container"&gt;
        	&lt;div class="ui-progress" style="width: 79%;"&gt;
				&lt;span class="ui-label" style="display:none;"&gt;Processing &lt;b class="value"&gt;79%&lt;/b&gt;&lt;/span&gt;
      		&lt;/div&gt;&lt;!-- .ui-progress --&gt;
    	&lt;/div&gt;&lt;!-- #progress_bar --&gt;  

		&lt;div class="content" id="main_content" style="display: none;"&gt;
	    	&lt;p&gt;Hello, World!&lt;/p&gt;
	  	&lt;/div&gt;&lt;!-- #main_content --&gt;
	&lt;/div&gt;&lt;!-- #container --&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>Let me explain the code a bit: On line 1, I&#8217;ve declared a HTML5 doctype. Then, lines 12 to 16 contains the markup for the progress bar itself. If you save the file and view it in your browser right now, you&#8217;ll see that nothing appears. Don&#8217;t worry, we&#8217;re going to apply so CSS3 magic in a minute.</p>
<h2>Diving into CSS3</h2>
<p>Open your <code>ui.css</code> file and paste the following code in it. There&#8217;s nothing fancy there, just some basic styles (that I&#8217;ve simplified from the original source) for the layout.</p>
<pre>body {
  background:#eee;
  padding: 30px;
  font-size: 62.5%;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  position: relative;
  margin: 0;
}

#container {
  margin: 0 auto;
  width: 460px;
  padding: 2em;
  background: #DCDDDF;

}

.ui-progress-bar {
  margin-top: 3em;
  margin-bottom: 3em;
} 

.ui-progress span.ui-label {
  font-size: 1.2em;
  position: absolute;
  right: 0;
  line-height: 33px;
  padding-right: 12px;
  color: rgba(0,0,0,0.6);
  text-shadow: rgba(255,255,255, 0.45) 0 1px 0px;
  white-space: nowrap;
}</pre>
<p>Once you are done, we can finally get into more serious things. The code below will make your progress bar come to life. I&#8217;ll explain it in details in a minute. For now, copy it and paste it in your <code>ui.css</code> file.</p>
<pre>@-webkit-keyframes animate-stripes {
  from {
    background-position: 0 0;
  }

  to {
   background-position: 44px 0;
  }
}      

.ui-progress-bar {
  position: relative;
  height: 35px;
  padding-right: 2px;
  background-color: #abb2bc;
  border-radius: 35px;
  -moz-border-radius: 35px;
  -webkit-border-radius: 35px;
  background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #b6bcc6), color-stop(1, #9da5b0));
  background: -moz-linear-gradient(#9da5b0 0%, #b6bcc6 100%);
  -webkit-box-shadow: inset 0px 1px 2px 0px rgba(0, 0, 0, 0.5), 0px 1px 0px 0px #FFF;
  -moz-box-shadow: inset 0px 1px 2px 0px rgba(0, 0, 0, 0.5), 0px 1px 0px 0px #FFF;
  box-shadow: inset 0px 1px 2px 0px rgba(0, 0, 0, 0.5), 0px 1px 0px 0px #FFF;
}        

.ui-progress {
  position: relative;
  display: block;
  overflow: hidden;
  height: 33px;
  -moz-border-radius: 35px;
  -webkit-border-radius: 35px;
  border-radius: 35px;
  -webkit-background-size: 44px 44px;
  background-color: #74d04c;
  background: -webkit-gradient(linear, 0 0, 44 44,
    color-stop(0.00, rgba(255,255,255,0.17)),
    color-stop(0.25, rgba(255,255,255,0.17)),
    color-stop(0.26, rgba(255,255,255,0)),
    color-stop(0.50, rgba(255,255,255,0)),
    color-stop(0.51, rgba(255,255,255,0.17)),
    color-stop(0.75, rgba(255,255,255,0.17)),
    color-stop(0.76, rgba(255,255,255,0)),
    color-stop(1.00, rgba(255,255,255,0))
  ), -webkit-gradient(linear, left bottom, left top, color-stop(0, #74d04c), color-stop(1, #9bdd62));
  background: -moz-repeating-linear-gradient(top left -30deg,
    rgba(255,255,255,0.17),
    rgba(255,255,255,0.17) 15px,
    rgba(255,255,255,0) 15px,
    rgba(255,255,255,0) 30px
  ), -moz-linear-gradient(#9bdd62 0%, #74d04c 100%);
  -webkit-box-shadow: inset 0px 1px 0px 0px #dbf383, inset 0px -1px 1px #58c43a;
  -moz-box-shadow: inset 0px 1px 0px 0px #dbf383, inset 0px -1px 1px #58c43a;
  box-shadow: inset 0px 1px 0px 0px #dbf383, inset 0px -1px 1px #58c43a;
  border: 1px solid #4c8932;
  -webkit-animation: animate-stripes 2s linear infinite;
}</pre>
<p>Save your <code>ui.css</code> file and view <code>progress.html</code> in your web browser, and you&#8217;ll see your gorgeous progress bar, done without using any image.<br /> So, what&#8217;s inside? Let me explain the code a bit.</p>
<p>First, we have two CSS classes: <code>.ui-progress-bar</code> and <code>.ui-progress</code>. The first is the container, and the second is the green progress bar.</p>
<ul>
<li><strong>Lines 1 to 9:</strong> These lines define a webkit-specific animation, which allows us to move an element from a pint to another.<br /> For more details about webkit animations, see <a href="http://webkit.org/blog/324/css-animation-2/">http://webkit.org/blog/324/css-animation-2/</a>.</li>
<li><strong>Line 16:</strong> The <code>border-radius</code> CSS3 property allows you to define a radius and get rounded corners.</li>
<li><strong>Line 17:</strong> Mozilla specific property for <code>border-radius</code>.</li>
<li><strong>Line 18:</strong> Webkit specific property for <code>border-radius</code>.</li>
<li><strong>Line 19:</strong> The -webkit-gradient property allows you to add a gradient to an element. It works only on Webkit, other browsers will ignore this property.</li>
<li><strong>Line 20:</strong> Mozilla specific property, similar to <code>-webkit-gradient</code> with a different syntax.</li>
<li><strong>Lines 21 to 23:</strong> <code>box-shadow</code> (and its browser specific alternatives) allows you to add a shadow to an element.</li>
<li><strong>Line 34:</strong> Webkit specific property, based on the standard <code>background-size</code> property, which allows you to specify the size of a background image.</li>
<li><strong>Line 56:</strong> Triggers webkit animation defined on line 1.</li>
</ul>
<h2>Final touch: Using jQuery to animate the progress bar</h2>
<p>A pure CSS3 progress bar is a very cool thing, but progress bars are here to show progress, so we have to animate it. We&#8217;re going to use jQuery to do so.</p>
<p>Open your <code>progress.html</code> file and paste the two line below just above the closing<code>&lt;/body&gt;</code> tag.</p>
<pre>&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;
&lt;script src="progress.js" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;</pre>
<p>This code will load jQuery from Google (Which I recommend to do instead of loading your own copy) as well as your <code>progress.js</code> file, which will contain the required code to animate the progress bar.</p>
<p>Now, paste the code below in your <code>progress.js</code> file:</p>
<pre>(function( $ ){
  $.fn.animateProgress = function(progress, callback) {
    return this.each(function() {
      $(this).animate({
        width: progress+'%'
      }, {
        duration: 2000, 

        easing: 'swing',

        step: function( progress ){
          var labelEl = $('.ui-label', this),
              valueEl = $('.value', labelEl);

          if (Math.ceil(progress) &lt; 20 &amp;&amp; $('.ui-label', this).is(":visible")) {
            labelEl.hide();
          }else{
            if (labelEl.is(":hidden")) {
              labelEl.fadeIn();
            };
          }

          if (Math.ceil(progress) == 100) {
            labelEl.text('Done');
            setTimeout(function() {
              labelEl.fadeOut();
            }, 1000);
          }else{
            valueEl.text(Math.ceil(progress) + '%');
          }
        },
        complete: function(scope, i, elem) {
          if (callback) {
            callback.call(this, i, elem );
          };
        }
      });
    });
  };
})( jQuery );

$(function() {
  $('#progress_bar .ui-progress .ui-label').hide();
  $('#progress_bar .ui-progress').css('width', '7%');

  $('#progress_bar .ui-progress').animateProgress(43, function() {
    $(this).animateProgress(79, function() {
      setTimeout(function() {
        $('#progress_bar .ui-progress').animateProgress(100, function() {
          $('#main_content').slideDown();
        });
      }, 2000);
    });
  });

});</pre>
<p>Save the file, and view <code>progress.html</code> in your web brower: Wow, the progress bar is now animated. How cool is that?</p>
<p>This Javascript code makes the progress bar go from 0 to 100, and then, it displays a message, which is simply &#8220;Hello World&#8221; in our tutorial.</p>
<p>I hope you enjoyed reading this tutorial as much as I enjoyed writing it. Have fun with CSS3!</p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/how-to-create-a-kick-ass-css3-progress-bar">How to create a kick-ass CSS3 progress bar</a></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/236e3_o09HNmakQlQ" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-a-kick-ass-css3-progress-bar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Feedback Form w/ PHP and jQuery</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/tutorial/quick-feedback-form-w-php-and-jquery/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/tutorial/quick-feedback-form-w-php-and-jquery/#comments</comments>
		<pubDate>Wed, 06 Oct 2010 07:35:54 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[tutorial]]></category>
		<category><![CDATA[class message]]></category>
		<category><![CDATA[css href]]></category>
		<category><![CDATA[div class]]></category>
		<category><![CDATA[div id]]></category>
		<category><![CDATA[doctype html]]></category>
		<category><![CDATA[html markup]]></category>
		<category><![CDATA[script src http]]></category>
		<category><![CDATA[span class]]></category>
		<category><![CDATA[web product]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/tutorial/quick-feedback-form-w-php-and-jquery/</guid>
		<description><![CDATA[When releasing a web product, there is nothing more beneficial than receiving early feedback from your users. Unfortunately, many websites make it unnecessarily difficult to send your feedback or lack this functionality altogether Today we are making a simple solution to this problem. Powered by jQuery, PHP and the PHPMailer class, this form sends the [...]]]></description>
			<content:encoded><![CDATA[<p>When releasing a web product, there is nothing more beneficial than receiving early feedback from your users. Unfortunately, many websites make it unnecessarily difficult to send your feedback or lack this functionality altogether</p>
<p>Today we are making a simple solution to this problem. Powered by jQuery, PHP and the PHPMailer class, this form sends the users&#8217; suggestions directly to your mailbox.</p>
<h3>The HTML</h3>
<p>Lets start with the HTML markup. The stylesheet is included in the top of the document, and the JavaScript source files in the bottom. This improves the perceived performance of the page, as the scripts are loaded last, thus allowing for the design of the site to be displayed.</p>
<h4>feedback.html</h4>
<pre>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Quick Feedback Form w/ PHP and jQuery | Tutorialzine Demo&lt;/title&gt;

&lt;link rel="stylesheet" type="text/css" href="styles.css" /&gt;

&lt;/head&gt;

&lt;body&gt;

&lt;div id="feedback"&gt;

    &lt;!-- Five color spans, floated to the left of each other --&gt;

    &lt;span class="color color-1"&gt;&lt;/span&gt;
    &lt;span class="color color-2"&gt;&lt;/span&gt;
    &lt;span class="color color-3"&gt;&lt;/span&gt;
    &lt;span class="color color-4"&gt;&lt;/span&gt;
    &lt;span class="color color-5"&gt;&lt;/span&gt;

    &lt;div class="section"&gt;

        &lt;!-- The arrow span is floated to the right --&gt;
        &lt;h6&gt;&lt;span class="arrow up"&gt;&lt;/span&gt;Feedback&lt;/h6&gt;

        &lt;p class="message"&gt;Please include your contact information if you'd like to receive a reply.&lt;/p&gt;

        &lt;textarea&gt;&lt;/textarea&gt;

        &lt;a class="submit" href=""&gt;Submit&lt;/a&gt;
    &lt;/div&gt;
&lt;/div&gt; 

&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt;
&lt;script src="script.js"&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>Inside the body you can see the <strong>#feedback</strong> div. It is anchored to the bottom-right of the window with a fixed positioning, as you will see in the next section of the tut.</p>
<p>Inside it reside the five color spans. These are 20% wide and floated to the left. This way they fill the exact width of the #feedback div.</p>
<p>Lastly is the <strong>.section</strong> container, which holds the heading, the textarea and the button.</p>
<div><a href="http://demo.tutorialzine.com/2010/09/quick-feedback-form-php-jquery/feedback.html"><img class="size-full wp-image-1188" title="Quick Feedback Form w/ PHP &amp; jQuery" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/82cc9_quick_feedback_form.jpg" alt="Quick Feedback Form w/ PHP &amp; jQuery" width="620" height="400" /></a>
<p>Quick Feedback Form w/ PHP &amp; jQuery</p>
</div>
<h3>The CSS</h3>
<p>Moving on to the styling of the form, we first have to say a couple of words about how the stylesheet is structured. As you can see from the CSS definitions below, each rule begins with <strong>#feedback</strong>. This way we achieve the CSS equivalent of namespaces, which makes it easier to add the code to an existing site without conflicts.</p>
<h4>styles.css &#8211; Part 1</h4>
<pre>#feedback{
    background-color:#9db09f;
    width:310px;
    height:330px;
    position:fixed;
    bottom:0;
    right:120px;
    margin-bottom:-270px;
    z-index:10000;
}

#feedback .section{
    background:url('img/bg.png') repeat-x top left;
    border:1px solid #808f81;
    border-bottom:none;
    padding:10px 25px 25px;
}

#feedback .color{
    float:left;
    height:4px;
    width:20%;
    overflow:hidden;
}

#feedback .color-1{ background-color:#d3b112;}
#feedback .color-2{ background-color:#12b6d3;}
#feedback .color-3{ background-color:#8fd317;}
#feedback .color-4{ background-color:#ca57df;}
#feedback .color-5{ background-color:#8ecbe7;}

#feedback h6{
    background:url("img/feedback.png") no-repeat;
    height:38px;
    margin:5px 0 12px;
    text-indent:-99999px;
    cursor:pointer;
}

#feedback textarea{
    background-color:#fff;
    border:none;
    color:#666666;
    font:13px 'Lucida Sans',Arial,sans-serif;
    height:100px;
    padding:10px;
    width:236px;

    -moz-box-shadow:4px 4px 0 #8a9b8c;
    -webkit-box-shadow:4px 4px 0 #8a9b8c;
    box-shadow:4px 4px 0 #8a9b8c;
}</pre>
<p>The first element to be styled is the <strong>#feedback</strong> div. It is applied a <a href="http://tutorialzine.com/2010/06/microtut-how-css-position-works/">fixed positioning</a>, and anchored to the browser window. After this comes the definition of the <strong><em>.section</em></strong> div, and the five color spans. These spans differ only in their background colors, which are assigned separately for each class.</p>
<p>At the bottom are the CSS rules which define the looks of the textarea.</p>
<h4>styles.css &#8211; Part 2</h4>
<pre>#feedback a.submit{
    background:url("img/submit.png") no-repeat;
    border:none;
    display:block;
    height:34px;
    margin:20px auto 0;
    text-decoration:none;
    text-indent:-99999px;
    width:91px;
}

#feedback a.submit:hover{
    background-position:left bottom;
}

#feedback a.submit.working{
    background-position:top right !important;
    cursor:default;
}

#feedback .message{
    font-family:Corbel,Arial,sans-serif;
    color:#5a665b;
    text-shadow:1px 1px 0 #b3c2b5;
    margin-bottom:20px;
}

#feedback .arrow{
    background:url('img/arrows.png') no-repeat;
    float:right;
    width:23px;
    height:18px;
    position:relative;
    top:10px;
}

#feedback .arrow.down{ background-position:left top;}
#feedback h6:hover .down{ background-position:left bottom;}
#feedback .arrow.up{ background-position:right top;}
#feedback h6:hover .up{ background-position:right bottom;}

#feedback .response{
    font-size:21px;
    margin-top:70px;
    text-align:center;
    text-shadow:2px 2px 0 #889889;
    color:#FCFCFC;
}</pre>
<p>In the second part of the stylesheet, you can see the definition of the submit button. Notice that there are three button states, which are contained withing the same background image &#8211; <em>submit.png</em> &#8211; and shown only when necessary. These are the default state of the button, the hover state, and the &#8220;<em>Working</em>&#8221; version. When the button is in its &#8220;<em>working</em>&#8221; mode, the hover effect is disabled.</p>
<div><a href="http://demo.tutorialzine.com/2010/09/quick-feedback-form-php-jquery/feedback.html"><img class="size-full wp-image-1189" title="Sending an AJAX Request" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/13de0_quick_feedback_working.jpg" alt="Sending an AJAX Request" width="620" height="260" /></a>
<p>Sending an AJAX Request</p>
</div>
<h3>The jQuery</h3>
<p>The feedback form has two states &#8211; minimized and maximized. When loaded, by default it is minimized to the bottom right of the screen. It is up to jQuery to maximize it when the user clicks the heading. This is done by binding an event listener and running a simple animation, as you can see from the code below.</p>
<h4>script.js &#8211; Part 1</h4>
<pre>$(document).ready(function(){

    // The relative URL of the submit.php script.
    // You will probably have to change it.
    var submitURL = 'submit.php';

    // Caching the feedback object:
    var feedback = $('#feedback');

    $('#feedback h6').click(function(){

        // We are storing the values of the animated
        // properties in a separate object:

        var anim    = {
            mb : 0,            // Margin Bottom
            pt : 25            // Padding Top
        };

        var el = $(this).find('.arrow');

        if(el.hasClass('down')){
            anim = {
                mb : -270,
                pt : 10
            };
        }

        // The first animation moves the form up or down, and the second one
        // moves the "Feedback" heading, so it fits in the minimized version

        feedback.stop().animate({marginBottom: anim.mb});

        feedback.find('.section').stop().animate({paddingTop:anim.pt},function(){
            el.toggleClass('down up');
        });
    });</pre>
<p>To keep the code clean, I&#8217;ve moved the if statements to the top and created the <code>anim</code> object, which holds the values fed to the animate method. Depending on whether the &#8216;<strong><em>down</em></strong>&#8216; class exists on the arrow, we maximize or minimize the form.</p>
<p>The second part of <em>script.js</em> handles the AJAX interactions with <em>submit.php</em>.</p>
<h4>script.js &#8211; Part 2</h4>
<pre>    $('#feedback a.submit').live('click',function(){
        var button = $(this);
        var textarea = feedback.find('textarea');

        // We use the working class not only for styling the submit button,
        // but also as kind of a "lock" to prevent multiple submissions.

        if(button.hasClass('working') || textarea.val().length &lt; 5){
            return false;
        }

        // Locking the form and changing the button style:
        button.addClass('working');

        $.ajax({
            url        : submitURL,
            type    : 'post',
            data    : { message : textarea.val()},
            complete    : function(xhr){

                var text = xhr.responseText;

                // This will help users troubleshoot their form:
                if(xhr.status == 404){
                    text = 'Your path to submit.php is incorrect.';
                }

                // Hiding the button and the textarea, after which
                // we are showing the received response from submit.php

                button.fadeOut();

                textarea.fadeOut(function(){
                    var span = $('&lt;span&gt;',{
                        className    : 'response',
                        html        : text
                    })
                    .hide()
                    .appendTo(feedback.find('.section'))
                    .show();
                }).val('');
            }
        });

        return false;
    });
});</pre>
<p>We are using jQuery&#8217;s lower-level AJAX method &#8211; <strong>$.ajax()</strong>, to interact with <em>submit.php</em>. This method gives us a bit more control on the connection than the <strong>$.get()</strong> and <strong>$.post()</strong> wrappers.</p>
<p>One benefit of using this method is visible in the &#8220;complete&#8221; callback function. There we match the response status for the <em>404 not found error</em>, and output a friendly error message to the user reminding them to check their <em>submitURL</em> path.</p>
<p>Now lets continue with the final part of the tutorial &#8211; the PHP step.</p>
<h3>The PHP</h3>
<p>PHP handles the data, passed with AJAX, sanitizes it, and sends an email message to your email address.</p>
<h4>submit.php</h4>
<pre>// Enter your email address below
$emailAddress = 'me@example.com';

// Using session to prevent flooding:

session_name('quickFeedback');
session_start();

// If the last form submit was less than 10 seconds ago,
// or the user has already sent 10 messages in the last hour

if(	$_SESSION['lastSubmit'] &amp;&amp; ( time() - $_SESSION['lastSubmit'] &lt; 10 || $_SESSION['submitsLastHour'][date('d-m-Y-H')] &gt; 10 )){
	die('Please wait for a few minutes before sending again.');
}

$_SESSION['lastSubmit'] = time();
$_SESSION['submitsLastHour'][date('d-m-Y-H')]++;

require "phpmailer/class.phpmailer.php";

if(ini_get('magic_quotes_gpc')){
    // If magic quotes are enabled, strip them
    $_POST['message'] = stripslashes($_POST['message']);
}

if(mb_strlen($_POST['message'],'utf-8') &lt; 5){
    die('Your feedback body is too short.');
}

$msg = nl2br(strip_tags($_POST['message']));

// Using the PHPMailer class

$mail = new PHPMailer();
$mail-&gt;IsMail();

// Adding the receiving email address
$mail-&gt;AddAddress($emailAddress);

$mail-&gt;Subject = 'New Quick Feedback Form Submission';
$mail-&gt;MsgHTML($msg);

$mail-&gt;AddReplyTo('noreply@'.$_SERVER['HTTP_HOST'], 'Quick Feedback Form');
$mail-&gt;SetFrom('noreply@'.$_SERVER['HTTP_HOST'], 'Quick Feedback Form');

$mail-&gt;Send();

echo 'Thank you!';</pre>
<p>First we use PHP&#8217;s session management to keep track of how many times the user has submitted the form in the last hour, and the time stamp of the last submission. If the difference between the last form submit and the current one is less than 10 seconds, or the user has sent more than 10 messages in the last hour, he is shown an error message.</p>
<p>The emails are sent with the <a href="http://phpmailer.worxware.com/" target="_blank">PHPMailer class</a>. It only works with PHP5, so to use the form you would need to be running that version of PHP.</p>
<p>A number of PHPMailer&#8217;s methods are used to configure the outgoing email. With <strong>IsMail()</strong> we are telling the class that it should use the internal <em>mail()</em> PHP function. <strong>AddAddress()</strong> ads the receiving email addresses (you can add more than one receiver with additional calls to the method). After adding the subject and the body, we specify the reply to address and send the message.</p>
<p><strong>With this our Quick Feedback Form is complete!</strong></p>
<h3>Final words</h3>
<p>You can use this form to gather quick feedback from your visitors. With such a low barrier to entry &#8211; just filling a single texbox, you will make it considerably easier for users to share their opinions and give ideas. The script is also structured so it is easy to customize and have minimal impact on your page.</p>
<div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/61428_iDnjdf7jWgU" height="1" width="1" /></p>
<p><a href="http://feeds.feedburner.com/Tutorialzine">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/tutorial/quick-feedback-form-w-php-and-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An HTML5 Slideshow w/ Canvas &amp; jQuery</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/tutorial/an-html5-slideshow-w-canvas-jquery/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/tutorial/an-html5-slideshow-w-canvas-jquery/#comments</comments>
		<pubDate>Wed, 06 Oct 2010 07:35:13 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[tutorial]]></category>
		<category><![CDATA[class slides]]></category>
		<category><![CDATA[div id]]></category>
		<category><![CDATA[doctype html]]></category>
		<category><![CDATA[html markup]]></category>
		<category><![CDATA[lighting effect]]></category>
		<category><![CDATA[span class]]></category>
		<category><![CDATA[special filter]]></category>
		<category><![CDATA[ul class]]></category>
		<category><![CDATA[vivid colors]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/tutorial/an-html5-slideshow-w-canvas-jquery/</guid>
		<description><![CDATA[You&#8217;ve probably heard a lot about the new HTML5 canvas element. As the name implies, this is a special element that allows us to create and modify graphics. In addition, we can also use it like any other element on the page &#8211; apply jQuery animations on it, listen for events and integrate it deeply [...]]]></description>
			<content:encoded><![CDATA[<p>You&#8217;ve probably heard a lot about the new HTML5 canvas element. As the name implies, this is a special element that allows us to create and modify graphics. In addition, we  can also use it like any other element on the page &#8211; apply jQuery animations on it, listen for events and integrate it deeply into our layouts.</p>
<p>All uses of canvas you&#8217;ve come so far are probably limited to games and other proof of concept demos. Today, however, we are doing something practical &#8211; we are making a progressively enhanced slideshow with a fancy transitioning effect, which is perfectly functional in older browsers as well.</p>
<h3>The Idea</h3>
<p>With JavaScript, we are going to apply a special filter to every image in the slideshow. We will create a new version of the images, with higher contrast and more vivid colors, and store it in a canvas elements.</p>
<div><a href="http://demo.tutorialzine.com/2010/09/html5-canvas-slideshow-jquery/html5-slideshow.html"><img class="size-full wp-image-1179" title="How the Slideshow Works" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/d19db_how_the_slideshow_works.jpg" alt="How the Slideshow Works" width="620" height="460" /></a>
<p>How the Slideshow Works</p>
</div>
<p>When the user chooses to proceed to another slide, the canvas is shown with a <em>fadeIn </em>animation, creating a smooth lighting effect.</p>
<h3>The HTML</h3>
<p>The first step in creating the slideshow, is laying down the HTML markup of the page.</p>
<h4>html5-slideshow.html</h4>
<pre>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;An HTML5 Slideshow w/ Canvas &amp; jQuery | Tutorialzine Demo&lt;/title&gt;

&lt;link rel="stylesheet" type="text/css" href="styles.css" /&gt;

&lt;/head&gt;

&lt;body&gt;

&lt;div id="slideshow"&gt;

    &lt;ul class="slides"&gt;
        &lt;li&gt;&lt;img src="img/photos/1.jpg" width="620" height="320" alt="Marsa Alam" /&gt;&lt;/li&gt;
        &lt;li&gt;&lt;img src="img/photos/2.jpg" width="620" height="320" alt="Turrimetta Beach" /&gt;&lt;/li&gt;
        &lt;li&gt;&lt;img src="img/photos/3.jpg" width="620" height="320" alt="Power Station" /&gt;&lt;/li&gt;
        &lt;li&gt;&lt;img src="img/photos/4.jpg" width="620" height="320" alt="Colors of Nature" /&gt;&lt;/li&gt;
    &lt;/ul&gt;

    &lt;span class="arrow previous"&gt;&lt;/span&gt;
    &lt;span class="arrow next"&gt;&lt;/span&gt;
&lt;/div&gt;

&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt;
&lt;script src="script.js"&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>First we have the HTML5 doctype, followed by the head section of the document. After the title tag and the stylesheet we move on with the body.</p>
<p>You can see that the markup for the slideshow is really simple. The main containing div, <strong>#slideshow</strong>, holds an <strong> </strong>unordered list and the previous and next arrows. The unordered list holds the slides, with each defined as a <code>LI</code> element. As shown in the illustration above, this is where the canvas elements with the modified versions of the images are inserted.</p>
<p>Lastly we include jQuery and our script.js, to which we are going to get back to in the last step of this tutorial.</p>
<h3>The CSS</h3>
<p>All the styles for the slideshow reside in styles.css. I&#8217;ve used the <strong>#slideshow</strong> id of the main containment element as a namespace, so you can easily append these styles to your stylesheet without worrying about conflicts.</p>
<h4>styles.css</h4>
<pre>#slideshow{
    background-color:#F5F5F5;
    border:1px solid #FFFFFF;
    height:340px;
    margin:150px auto 0;
    position:relative;
    width:640px;

    -moz-box-shadow:0 0 22px #111;
    -webkit-box-shadow:0 0 22px #111;
    box-shadow:0 0 22px #111;
}

#slideshow ul{
    height:320px;
    left:10px;
    list-style:none outside none;
    overflow:hidden;
    position:absolute;
    top:10px;
    width:620px;
}

#slideshow li{
    position:absolute;
    display:none;
    z-index:10;
}

#slideshow li:first-child{
    display:block;
    z-index:1000;
}

#slideshow .slideActive{
    z-index:1000;
}

#slideshow canvas{
    display:none;
    position:absolute;
    z-index:100;
}

#slideshow .arrow{
    height:86px;
    width:60px;
    position:absolute;
    background:url('img/arrows.png') no-repeat;
    top:50%;
    margin-top:-43px;
    cursor:pointer;
    z-index:5000;
}

#slideshow .previous{ background-position:left top;left:0;}
#slideshow .previous:hover{ background-position:left bottom;}

#slideshow .next{ background-position:right top;right:0;}
#slideshow .next:hover{ background-position:right bottom;}</pre>
<p>We can split our visitors, which will interact with the slideshow, in three main groups:</p>
<ul>
<li><strong>People with JavaScript switched off</strong>. These users will only see the first slide, and will be unable to switch to a different one;</li>
<li><strong>People with JavaScript switched on, but with no support for canvas</strong>. For visitors from this group, the slides will change instantaneously, without transitioning effects;</li>
<li><strong>People with JavaScript enabled and canvas support.</strong> These are people who use the latest versions of Firefox, Safari, Chrome, Opera and the soon to be released IE9. They will enjoy the slideshow in its full glory;</li>
</ul>
<p>To account for the first two groups, a number of rules are applied to the stylesheet. With the help of the <strong>first-child</strong> selector, only the first slide is shown by default. Also a number of <strong>overflow:hidden</strong> rules are applied in a number of places just in case.</p>
<div><a href="http://demo.tutorialzine.com/2010/09/html5-canvas-slideshow-jquery/html5-slideshow.html"><img class="size-full wp-image-1180" title="An HTML5 Slideshow With Canvas &amp; jQuery" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/aaf89_html5_canvas_slideshow.jpg" alt="An HTML5 Slideshow With Canvas &amp; jQuery" width="620" height="460" /></a>
<p>An HTML5 Slideshow With Canvas &amp; jQuery</p>
</div>
<h3>The JavaScript</h3>
<p>Moving on to the last part of the tutorial &#8211; the JavaScript and jQuery code. As we already explained the basic principles behind the effect, lets move straight to the execution.</p>
<h4>script.js &#8211; Part 1</h4>
<pre>$(window).load(function(){

    // We are listening to the window.load event, so we can be sure
    // that the images in the slideshow are loaded properly.

    // Testing wether the current browser supports the canvas element:
    var supportCanvas = 'getContext' in document.createElement('canvas');

    // The canvas manipulations of the images are CPU intensive,
    // this is why we are using setTimeout to make them asynchronous
    // and improve the responsiveness of the page.

    var slides = $('#slideshow li'),
        current = 0,
        slideshow = {width:0,height:0};

    setTimeout(function(){

        if(supportCanvas){
            $('#slideshow img').each(function(){

                if(!slideshow.width){
                    // Saving the dimensions of the first image:
                    slideshow.width = this.width;
                    slideshow.height = this.height;
                }

                // Rendering the modified versions of the images:
                createCanvasOverlay(this);
            });
        }

        $('#slideshow .arrow').click(function(){
            var li            = slides.eq(current),
                canvas        = li.find('canvas'),
                nextIndex    = 0;

            // Depending on whether this is the next or previous
            // arrow, calculate the index of the next slide accordingly.

            if($(this).hasClass('next')){
                nextIndex = current &gt;= slides.length-1 ? 0 : current+1;
            }
            else {
                nextIndex = current &lt;= 0 ? slides.length-1 : current-1;
            }

            var next = slides.eq(nextIndex);

            if(supportCanvas){

                // This browser supports canvas, fade it into view:

                canvas.fadeIn(function(){

                    // Show the next slide below the current one:
                    next.show();
                    current = nextIndex;

                    // Fade the current slide out of view:
                    li.fadeOut(function(){
                        li.removeClass('slideActive');
                        canvas.hide();
                        next.addClass('slideActive');
                    });
                });
            }
            else {

                // This browser does not support canvas.
                // Use the plain version of the slideshow.

                current=nextIndex;
                next.addClass('slideActive').show();
                li.removeClass('slideActive').hide();
            }
        });

    },100);</pre>
<p>With <code>document.createElement()</code>, you can create any DOM element that you like. So to test whether the browser really supports canvas (and doesn&#8217;t just create a generic element), we use the <code>in</code> operator to check for the <code>getContext()</code> method, which is an integral part of the standard. The result of this check is used throughout the code to account for users with browsers that do not yet support canvas.</p>
<p>Notice that the calls to the <strong>createCanvasOverlay</strong> function (which we will discuss in the second part of the code) are enclosed in a setTimeout statement. This is done because the function is processor intensive and might cause the browser window to stall. setTimeout breaks out of the main execution path and runs the code asynchronously, maximizing the responsiveness of the page.</p>
<h4>script.js &#8211; Part 2</h4>
<pre>    // This function takes an image and renders
    // a version of it similar to the Overlay blending
    // mode in Photoshop.

    function createCanvasOverlay(image){

        var canvas            = document.createElement('canvas'),
            canvasContext    = canvas.getContext("2d");

        // Make it the same size as the image
        canvas.width = slideshow.width;
        canvas.height = slideshow.height;

        // Drawing the default version of the image on the canvas:
        canvasContext.drawImage(image,0,0);

        // Taking the image data and storing it in the imageData array:
        var imageData    = canvasContext.getImageData(0,0,canvas.width,canvas.height),
            data        = imageData.data;

        // Loop through all the pixels in the imageData array, and modify
        // the red, green, and blue color values.

        for(var i = 0,z=data.length;i&lt;z;i++){

            // The values for red, green and blue are consecutive elements
            // in the imageData array. We modify the three of them at once:

            data[i] = ((data[i] &lt; 128) ? (2*data[i]*data[i] / 255) :
                        (255 - 2 * (255 - data[i]) * (255 - data[i]) / 255));
            data[++i] = ((data[i] &lt; 128) ? (2*data[i]*data[i] / 255) :
                        (255 - 2 * (255 - data[i]) * (255 - data[i]) / 255));
            data[++i] = ((data[i] &lt; 128) ? (2*data[i]*data[i] / 255) :
                        (255 - 2 * (255 - data[i]) * (255 - data[i]) / 255));

            // After the RGB channels comes the alpha value, which we leave the same.
            ++i;
        }

        // Putting the modified imageData back on the canvas.
        canvasContext.putImageData(imageData,0,0,0,0,imageData.width,imageData.height);

        // Inserting the canvas in the DOM, before the image:
        image.parentNode.insertBefore(canvas,image);
    }

});</pre>
<p>This is where the magic happens. The canvas element is basically one big piece of paper on which you can draw with JavaScript. The code above creates a blank canvas element and imports the image, which was passed as a parameter, with the <code>drawImage()</code> method. After this, we use the <code>getImageData()</code> method to export the contents of all the pixels of the canvas into the <strong>imageData</strong> array.</p>
<p>What is more, for each pixel of the image we have four entries in the array &#8211; one for the red, green and blue colors, and the alpha channel (the transparency). These are all numbers from <em>0</em> to <em>255</em>. The main <em><strong>for</strong> </em>loop has to go through all the pixels and apply a special filter equation that lightens the lighter colors and darkens the dark ones. It is the same effect that you get by using the <strong>overlay blending mode in photoshop</strong>.</p>
<p>The main <em><strong>for </strong></em>loop has to do an incredible amount of work &#8211; for a <strong>600&#215;400</strong> pixel image it does <strong>240 000</strong> iterations! This means that your code must be as optimal as possible. This is why, in the loop, I copied the formula three times instead of calling a function. By removing the function calls the loop became nearly <strong>three times faster</strong>.</p>
<blockquote><p>Be aware that the rendering time will grow proportionally, if you decide to include more slides, or use larger images.</p>
</blockquote>
<p><strong>With this our HTML5 Canvas Slideshow is complete!</strong></p>
<h3>Final words</h3>
<p>The canvas element opens a whole new way of building rich internet applications. For those of you who are curious, on a relatively new PC, it takes Firefox 1.2 seconds to generate all four canvas images, while Chrome is faster at 0.67s. Considering the amount of work that is done, this is a really impressive achievement.</p>
<div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/cb62f_94Q89DY_psw" height="1" width="1" /></p>
<p><a href="http://feeds.feedburner.com/Tutorialzine">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/tutorial/an-html5-slideshow-w-canvas-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>View Source Tutorial: Content Site Using HTML5 Canvas + CSS3</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/view-source-tutorial-content-site-using-html5-canvas-css3/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/view-source-tutorial-content-site-using-html5-canvas-css3/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 18:15:34 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[web resources]]></category>
		<category><![CDATA[color html]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[div class]]></category>
		<category><![CDATA[performance practice]]></category>
		<category><![CDATA[phil franks]]></category>
		<category><![CDATA[script tags]]></category>
		<category><![CDATA[span class]]></category>
		<category><![CDATA[style rule]]></category>
		<category><![CDATA[view source]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/view-source-tutorial-content-site-using-html5-canvas-css3/</guid>
		<description><![CDATA[Via Phil Franks comes an interesting HTML5/CSS3 site for There Studio, which is a kind of coworking space in London: The site itself has a number of circles with information bouncing on the screen that respond to mouse clicks and moves. Let&#8217;s crack the site open using View Source and see how they are doing [...]]]></description>
			<content:encoded><![CDATA[<p>Via <a href="http://twitter.com/phil_franks">Phil Franks</a> comes an interesting HTML5/CSS3 site for <a href="http://www.therestudio.com/">There Studio</a>, which is a kind of coworking space in London:<br />
<a href="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/256ee_therestudio1.png"><img class="aligncenter size-full wp-image-10023" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/256ee_therestudio1.png" alt="" width="505" height="241" /></a></p>
<p>The site itself has a number of circles with information bouncing on the screen that respond to mouse clicks and moves.</p>
<p>Let&#8217;s crack the site open using View Source and see how they are doing things. First, they have a repeated background with a little plus symbol with the following style rule on the &lt;body&gt; tag:</p>
<div><a href="showCodeTxt('css-10');">PLAIN TEXT</a></div>
<div><span>CSS:</span></p>
<div>
<div>
<span>background</span>: #ddd <span>url</span><span>&#040;</span><span>&#8216;../images/bg.gif&#8217;</span><span>&#041;</span> <span>50</span>% <span>0</span> <span>repeat</span> <span>fixed</span>;<br />
&nbsp;</div>
</div>
</div>
<p>The textual content in each of the circles is clean semantic HTML that is search engine friendly:</p>
<div><a href="showCodeTxt('html-11');">PLAIN TEXT</a></div>
<div><span>HTML:</span></p>
<div>
<div><span><a href="http://december.com/html/4/element/div.html"><span>&lt;div</span></a> <span>class</span>=<span>&#8220;section who first&#8221;</span><span>&gt;</span></a></span> <br />
&nbsp; <span><a href="http://december.com/html/4/element/h3.html"><span>&lt;h3&gt;</span></a></span>Who<span><span>&lt;/h3&gt;</span></span> <br />
&nbsp; <span><a href="http://december.com/html/4/element/p.html"><span>&lt;p&gt;</span></a></span>Creatives, makers, thinkers <span><a href="http://december.com/html/4/element/span.html"><span>&lt;span</span></a> <span>class</span>=<span>&#8220;ampersand&#8221;</span><span>&gt;</span></a></span><span>&amp;amp;</span><span><span>&lt;/span&gt;</span></span> doers<span><span>&lt;/p&gt;</span></span> <br />
<span><span>&lt;/div&gt;</span></span></div>
</div>
</div>
<p>To turn that into this:<br />
<a href="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/a27eb_therestudio2.png"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/a27eb_therestudio2.png" alt="" width="209" height="213" class="aligncenter size-full wp-image-10026" /></a></p>
<p>The &lt;h3&gt; is first transformed into having an underline with the padding and margin being on the bottom:</p>
<div><a href="showCodeTxt('css-12');">PLAIN TEXT</a></div>
<div><span>CSS:</span></p>
<div>
<div>
h3 <span>&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span>border-bottom</span>: 1px <span>solid</span> #ccc;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span>display</span>: <span>block</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span>font-size</span>: 25px;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span>font-weight</span>: <span>normal</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span>padding</span>: <span>0</span> <span>0</span> 10px;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span>margin</span>: <span>0</span> <span>0</span> 8px;<br />
<span>&#125;</span><br />
&nbsp;</div>
</div>
</div>
<p><a href="http://www.therestudio.com/media/js/main.js">JavaScript creates the circle</a>. The script tags themselves are at the end of the HTML page at the bottom of the &lt;body&gt; tag, a good performance practice in general.</p>
<p>The heart of drawing each circle is in the createBall and createContentBall methods. If a ball will have HTML content, then the createContentBall method is used, otherwise the createBall method is used. Let&#8217;s look at the createContentBall method; we&#8217;ll break it down:</p>
<div><a href="showCodeTxt('javascript-13');">PLAIN TEXT</a></div>
<div><span>JAVASCRIPT:</span></p>
<div>
<div>
<span>function</span> createContentBall<span>&#040;</span>className,size,color,html<span>&#041;</span> <span>&#123;</span><br />
&nbsp; <span>var</span> element = document.<span>createElement</span><span>&#040;</span> <span>&#8216;div&#8217;</span> <span>&#041;</span>;<br />
&nbsp; element.<span>className</span> = className;<br />
&nbsp; element.<span>width</span> = element.<span>height</span> = size;<br />
&nbsp; element.<span>style</span>.<span>position</span> = <span>&#8216;absolute&#8217;</span>;<br />
&nbsp; element.<span>style</span>.<span>left</span> = -size + <span>&#8216;px&#8217;</span>;<br />
&nbsp; element.<span>style</span>.<span>top</span> = -size + <span>&#8216;px&#8217;</span>;<br />
&nbsp; element.<span>style</span>.<span>cursor</span> = <span>&#8220;default&#8221;</span>;<br />
&nbsp; canvas.<span>appendChild</span><span>&#040;</span>element<span>&#041;</span>;<br />
&nbsp; elements.<span>push</span><span>&#040;</span> element <span>&#041;</span>;<br />
&nbsp; <span>var</span> circle = document.<span>createElement</span><span>&#040;</span> <span>&#8216;canvas&#8217;</span> <span>&#041;</span>;<br />
&nbsp; circle.<span>width</span> = size;<br />
&nbsp; circle.<span>height</span> = size;<br />
&nbsp; <span>if</span> <span>&#040;</span>className !==<span>&#8216;image&#8217;</span> &amp;&amp; className !==<span>&#8216;image first&#8217;</span><span>&#041;</span> <span>&#123;</span><br />
&nbsp; &nbsp; <span>var</span> graphics = circle.<span>getContext</span><span>&#040;</span> <span>&#8217;2d&#8217;</span> <span>&#041;</span>;<br />
&nbsp; &nbsp; graphics.<span>fillStyle</span> = color;<br />
&nbsp; &nbsp; graphics.<span>beginPath</span><span>&#040;</span><span>&#041;</span>;<br />
&nbsp; &nbsp; graphics.<span>arc</span><span>&#040;</span> size * .<span>5</span>, size * .<span>5</span>, size * .<span>5</span>, <span>0</span>, PI2, <span>true</span> <span>&#041;</span>;<br />
&nbsp; &nbsp; graphics.<span>closePath</span><span>&#040;</span><span>&#041;</span>;<br />
&nbsp; &nbsp; graphics.<span>fill</span><span>&#040;</span><span>&#041;</span>;<br />
&nbsp; <span>&#125;</span><br />
&nbsp; element.<span>appendChild</span><span>&#040;</span> circle <span>&#041;</span>;<br />
&nbsp; content = document.<span>createElement</span><span>&#040;</span> <span>&#8216;div&#8217;</span> <span>&#041;</span>;<br />
&nbsp; content.<span>className</span> = <span>&#8220;content&#8221;</span>;<br />
&nbsp; content.<span>onSelectStart</span> = <span>null</span>;<br />
&nbsp; content.<span>innerHTML</span> = html;<br />
&nbsp; element.<span>appendChild</span><span>&#040;</span>content<span>&#041;</span>;<br />
&nbsp; <span>if</span> <span>&#040;</span>className !==<span>&#8216;image&#8217;</span> &amp;&amp; className !==<span>&#8216;image first&#8217;</span> <span>&#041;</span> <span>&#123;</span><br />
&nbsp; &nbsp; content.<span>style</span>.<span>width</span> = <span>&#040;</span>size &#8211; contentPadding*<span>2</span><span>&#041;</span> + <span>&#8216;px&#8217;</span>;<br />
&nbsp; &nbsp; content.<span>style</span>.<span>left</span> = <span>&#040;</span><span>&#040;</span><span>&#040;</span>size &#8211; content.<span>clientWidth</span><span>&#041;</span> / <span>2</span><span>&#041;</span><span>&#041;</span> +<span>&#8216;px&#8217;</span>;<br />
&nbsp; &nbsp; content.<span>style</span>.<span>top</span> = <span>&#040;</span><span>&#040;</span>size &#8211; content.<span>clientHeight</span><span>&#041;</span> / <span>2</span><span>&#041;</span> +<span>&#8216;px&#8217;</span>;<br />
&nbsp; <span>&#125;</span><br />
&nbsp; <span>var</span> b2body = <span>new</span> b2BodyDef<span>&#040;</span><span>&#041;</span>;<br />
&nbsp; <span>var</span> circle = <span>new</span> b2CircleDef<span>&#040;</span><span>&#041;</span>;<br />
&nbsp; circle.<span>radius</span> = size / <span>2</span>;<br />
&nbsp; circle.<span>density</span> = ballDensity;<br />
&nbsp; circle.<span>friction</span> = ballFriction;<br />
&nbsp; circle.<span>restitution</span> = ballRestitution;<br />
&nbsp; b2body.<span>AddShape</span><span>&#040;</span>circle<span>&#041;</span>;<br />
&nbsp; b2body.<span>userData</span> = <span>&#123;</span>element: element<span>&#125;</span>;<br />
&nbsp; b2body.<span>position</span>.<span>Set</span><span>&#040;</span> Math.<span>random</span><span>&#040;</span><span>&#041;</span> * stage<span>&#091;</span><span>2</span><span>&#093;</span>, Math.<span>random</span><span>&#040;</span><span>&#041;</span> * <span>&#040;</span>stage<span>&#091;</span><span>3</span><span>&#093;</span>-size<span>&#041;</span> + size/<span>2</span><span>&#041;</span>;<br />
&nbsp; b2body.<span>linearVelocity</span>.<span>Set</span><span>&#040;</span> Math.<span>random</span><span>&#040;</span><span>&#041;</span> * <span>200</span>, Math.<span>random</span><span>&#040;</span><span>&#041;</span> * <span>200</span> <span>&#041;</span>;<br />
&nbsp; bodies.<span>push</span><span>&#040;</span> world.<span>CreateBody</span><span>&#040;</span>b2body<span>&#041;</span> <span>&#041;</span>;<br />
<span>&#125;</span><br />
&nbsp;</div>
</div>
</div>
<p>First, we create an absolutely positioned DIV that will house our Canvas tag:</p>
<div><a href="showCodeTxt('javascript-14');">PLAIN TEXT</a></div>
<div><span>JAVASCRIPT:</span></p>
<div>
<div>
<span>var</span> element = document.<span>createElement</span><span>&#040;</span> <span>&#8216;div&#8217;</span> <span>&#041;</span>;<br />
element.<span>className</span> = className;<br />
element.<span>width</span> = element.<span>height</span> = size;<br />
element.<span>style</span>.<span>position</span> = <span>&#8216;absolute&#8217;</span>;<br />
element.<span>style</span>.<span>left</span> = -size + <span>&#8216;px&#8217;</span>;<br />
element.<span>style</span>.<span>top</span> = -size + <span>&#8216;px&#8217;</span>;<br />
element.<span>style</span>.<span>cursor</span> = <span>&#8220;default&#8221;</span>;<br />
canvas.<span>appendChild</span><span>&#040;</span>element<span>&#041;</span>;<br />
elements.<span>push</span><span>&#040;</span> element <span>&#041;</span>;<br />
&nbsp;</div>
</div>
</div>
<p>Then we draw the actual circle itself using the Canvas tag and append it to our container DIV (Note that an SVG circle created programmatically could have also been used here):</p>
<div><a href="showCodeTxt('javascript-15');">PLAIN TEXT</a></div>
<div><span>JAVASCRIPT:</span></p>
<div>
<div>
<span>var</span> circle = document.<span>createElement</span><span>&#040;</span> <span>&#8216;canvas&#8217;</span> <span>&#041;</span>;<br />
circle.<span>width</span> = size;<br />
circle.<span>height</span> = size;<br />
<span>if</span> <span>&#040;</span>className !==<span>&#8216;image&#8217;</span> &amp;&amp; className !==<span>&#8216;image first&#8217;</span><span>&#041;</span> <span>&#123;</span><br />
&nbsp; &nbsp;<span>var</span> graphics = circle.<span>getContext</span><span>&#040;</span> <span>&#8217;2d&#8217;</span> <span>&#041;</span>;<br />
&nbsp; &nbsp;graphics.<span>fillStyle</span> = color;<br />
&nbsp; &nbsp;graphics.<span>beginPath</span><span>&#040;</span><span>&#041;</span>;<br />
&nbsp; &nbsp;graphics.<span>arc</span><span>&#040;</span> size * .<span>5</span>, size * .<span>5</span>, size * .<span>5</span>, <span>0</span>, PI2, <span>true</span> <span>&#041;</span>;<br />
&nbsp; &nbsp;graphics.<span>closePath</span><span>&#040;</span><span>&#041;</span>;<br />
&nbsp; &nbsp;graphics.<span>fill</span><span>&#040;</span><span>&#041;</span>;<br />
<span>&#125;</span><br />
element.<span>appendChild</span><span>&#040;</span> circle <span>&#041;</span>;<br />
&nbsp;</div>
</div>
</div>
<p>Then we create another DIV to house the HTML content itself:</p>
<div><a href="showCodeTxt('javascript-16');">PLAIN TEXT</a></div>
<div><span>JAVASCRIPT:</span></p>
<div>
<div>
content = document.<span>createElement</span><span>&#040;</span> <span>&#8216;div&#8217;</span> <span>&#041;</span>;<br />
content.<span>className</span> = <span>&#8220;content&#8221;</span>;<br />
content.<span>onSelectStart</span> = <span>null</span>;<br />
content.<span>innerHTML</span> = html;<br />
element.<span>appendChild</span><span>&#040;</span>content<span>&#041;</span>;<br />
<span>if</span> <span>&#040;</span>className !==<span>&#8216;image&#8217;</span> &amp;&amp; className !==<span>&#8216;image first&#8217;</span> <span>&#041;</span> <span>&#123;</span><br />
&nbsp; &nbsp;content.<span>style</span>.<span>width</span> = <span>&#040;</span>size &#8211; contentPadding*<span>2</span><span>&#041;</span> + <span>&#8216;px&#8217;</span>;<br />
&nbsp; &nbsp;content.<span>style</span>.<span>left</span> = <span>&#040;</span><span>&#040;</span><span>&#040;</span>size &#8211; content.<span>clientWidth</span><span>&#041;</span> / <span>2</span><span>&#041;</span><span>&#041;</span> +<span>&#8216;px&#8217;</span>;<br />
&nbsp; &nbsp;content.<span>style</span>.<span>top</span> = <span>&#040;</span><span>&#040;</span>size &#8211; content.<span>clientHeight</span><span>&#041;</span> / <span>2</span><span>&#041;</span> +<span>&#8216;px&#8217;</span>;<br />
<span>&#125;</span><br />
&nbsp;</div>
</div>
</div>
<p>Notice that we are setting content.onSelectStart to null above; this is so that when you run the mouse button over the text it doesn&#8217;t select (An alternative way to do this is to use the <a href="http://hacks.mozilla.org/2009/12/pointer-events-for-html-in-firefox-3-6/">HTML pointer-events CSS property</a>).</p>
<p>Next comes code to deal with the physics of the circles, which uses <a href="http://box2d-js.sourceforge.net/">Box2D.js</a>, a JavaScript physics engine ported from Flash:</p>
<div><a href="showCodeTxt('javascript-17');">PLAIN TEXT</a></div>
<div><span>JAVASCRIPT:</span></p>
<div>
<div>
<span>var</span> b2body = <span>new</span> b2BodyDef<span>&#040;</span><span>&#041;</span>;<br />
<span>var</span> circle = <span>new</span> b2CircleDef<span>&#040;</span><span>&#041;</span>;<br />
circle.<span>radius</span> = size / <span>2</span>;<br />
circle.<span>density</span> = ballDensity;<br />
circle.<span>friction</span> = ballFriction;<br />
circle.<span>restitution</span> = ballRestitution;<br />
b2body.<span>AddShape</span><span>&#040;</span>circle<span>&#041;</span>;<br />
b2body.<span>userData</span> = <span>&#123;</span>element: element<span>&#125;</span>;<br />
b2body.<span>position</span>.<span>Set</span><span>&#040;</span> Math.<span>random</span><span>&#040;</span><span>&#041;</span> * stage<span>&#091;</span><span>2</span><span>&#093;</span>, Math.<span>random</span><span>&#040;</span><span>&#041;</span> * <span>&#040;</span>stage<span>&#091;</span><span>3</span><span>&#093;</span>-size<span>&#041;</span> + size/<span>2</span><span>&#041;</span>;<br />
b2body.<span>linearVelocity</span>.<span>Set</span><span>&#040;</span> Math.<span>random</span><span>&#040;</span><span>&#041;</span> * <span>200</span>, Math.<span>random</span><span>&#040;</span><span>&#041;</span> * <span>200</span> <span>&#041;</span>;<br />
bodies.<span>push</span><span>&#040;</span> world.<span>CreateBody</span><span>&#040;</span>b2body<span>&#041;</span> <span>&#041;</span>;<br />
&nbsp;</div>
</div>
</div>
<p>Basically, we define a circle, give it a radius, density, friction, and restitution, and then add it to our collection of shapes with a position and linear velocity. Box2D will then handle the physics and we can just take the values back out to draw things on the screen with a setInterval, which happens in the loop method:</p>
<div><a href="showCodeTxt('javascript-18');">PLAIN TEXT</a></div>
<div><span>JAVASCRIPT:</span></p>
<div>
<div>
<span>function</span> loop<span>&#040;</span><span>&#041;</span> <span>&#123;</span><br />
&nbsp; delta<span>&#091;</span><span>0</span><span>&#093;</span> += <span>&#040;</span><span>0</span> &#8211; delta<span>&#091;</span><span>0</span><span>&#093;</span><span>&#041;</span> * .<span>5</span>;<br />
&nbsp; delta<span>&#091;</span><span>1</span><span>&#093;</span> += <span>&#040;</span><span>0</span> &#8211; delta<span>&#091;</span><span>1</span><span>&#093;</span><span>&#041;</span> * .<span>5</span>;<br />
&nbsp; world.<span>m_gravity</span>.<span>x</span> = <span>0</span> <span>// -(0 + delta[0]);</span><br />
&nbsp; world.<span>m_gravity</span>.<span>y</span> = -<span>&#040;</span><span>100</span> + delta<span>&#091;</span><span>1</span><span>&#093;</span><span>&#041;</span>;<br />
&nbsp; mouseDrag<span>&#040;</span><span>&#041;</span>;<br />
&nbsp; world.<span>Step</span><span>&#040;</span>timeStep, iterations<span>&#041;</span>;<br />
&nbsp; <span>for</span> <span>&#040;</span>i = <span>0</span>; i &lt;bodies.<span>length</span>; i++<span>&#041;</span> <span>&#123;</span><br />
&nbsp; &nbsp; <span>var</span> body = bodies<span>&#091;</span>i<span>&#093;</span>;<br />
&nbsp; &nbsp; <span>var</span> element = elements<span>&#091;</span>i<span>&#093;</span>;<br />
&nbsp; &nbsp; element.<span>style</span>.<span>left</span> = <span>&#040;</span>body.<span>m_position0</span>.<span>x</span> &#8211; <span>&#040;</span>element.<span>width</span>&gt;&gt; <span>1</span><span>&#041;</span><span>&#041;</span> + <span>&#8216;px&#8217;</span>;<br />
&nbsp; &nbsp; element.<span>style</span>.<span>top</span> = <span>&#040;</span>body.<span>m_position0</span>.<span>y</span> &#8211; <span>&#040;</span>element.<span>height</span>&gt;&gt; <span>1</span><span>&#041;</span><span>&#041;</span> + <span>&#8216;px&#8217;</span>;<br />
&nbsp; &nbsp; <span>if</span> <span>&#040;</span>ballRotation &amp;&amp; element.<span>tagName</span> == <span>&#8216;DIV&#8217;</span><span>&#041;</span> <span>&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span>var</span> rotationStyle = <span>&#8216;rotate(&#8216;</span> + <span>&#040;</span>body.<span>m_rotation0</span> * <span>57</span>.<span>2957795</span><span>&#041;</span> + <span>&#8216;deg)&#8217;</span>;<br />
&nbsp; &nbsp; &nbsp; element.<span>style</span>.<span>WebkitTransform</span> = rotationStyle;<br />
&nbsp; &nbsp; &nbsp; element.<span>style</span>.<span>MozTransform</span> = rotationStyle;<br />
&nbsp; &nbsp; &nbsp; element.<span>style</span>.<span>OTransform</span> = rotationStyle;<br />
&nbsp; &nbsp; <span>&#125;</span><br />
&nbsp; <span>&#125;</span><br />
<span>&#125;</span><br />
&nbsp;</div>
</div>
</div>
<p>This method gets called with a setInterval periodically. Basically, we apply a delta and a gravity at each time step; see if the mouse is being pressed down (with hooks for touch devices like the iPhone to see if a finger is being pressed down); tell the Box2D World about our gravity and delta and to make an iteration step; and finally use the computed physics values from Box2D to apply CSS3 rotation transforms on our parent DIV and move the element&#8217;s CSS top and left values around the screen.</p>
<div>
</div>
<p><a href="http://feeds2.feedburner.com/ajaxian">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/view-source-tutorial-content-site-using-html5-canvas-css3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Create a Cool Slide Out Panel with CSS3 only</title>
		<link>http://www.neurosoftware.ro/programming-blog/blogposter/web-resources/how-to-create-a-cool-slide-out-panel-with-css3-only/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/blogposter/web-resources/how-to-create-a-cool-slide-out-panel-with-css3-only/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 04:30:15 +0000</pubDate>
		<dc:creator>BlogPoster</dc:creator>
				<category><![CDATA[web resources]]></category>
		<category><![CDATA[animated slide]]></category>
		<category><![CDATA[animation effect]]></category>
		<category><![CDATA[content area]]></category>
		<category><![CDATA[html public]]></category>
		<category><![CDATA[smooth animation]]></category>
		<category><![CDATA[span class]]></category>
		<category><![CDATA[transitional dtd]]></category>
		<category><![CDATA[web kit]]></category>
		<category><![CDATA[website layout]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/blogposter/web-resources/how-to-create-a-cool-slide-out-panel-with-css3-only/</guid>
		<description><![CDATA[Many sites have a really cool hidden panel which contains some relevant information and this panel is revealed to us, with a cool animation, when we click on a particular button or hover over it. This has usually been achieved using jQuery. But now as we advent towards the future and CSS3 is becoming a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.1stwebdesigner.com/tutorials/slide-out-panel-css3/"><img class="alignleft size-full wp-image-18514" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/31fe9_slide-out-css3-150.jpg" alt="Create a slideout panel by just using CSS3 only" width="150" height="150" /></a>Many sites have a really cool hidden panel which contains some relevant information and this panel is revealed to us, with a cool animation, when we click on a particular button or hover over it. This has usually been achieved using jQuery. But now as we advent towards the future and CSS3 is becoming a reality, here is a tutorial on how to build an animated slide out panel using only CSS3.<span></span></p>
<p><strong><span>Note:</span></strong> This tutorial uses some advanced css3 techniques which are not yet supported in Firefox. To get the full version, you should see the live demo in a web-kit engine for example Safari and Chrome. You can download the source code <a href="http://www.1stwebdesigner.com/wp-content/uploads/2010/07/css3-slider.zip">here</a>. The final demo can also be seen <a href="http://www.1stwebdesigner.com/wp-content/uploads/2010/07/css3-slider/index.html">here</a>. </p>
<h2>Step 1: Analyzing the Goal</h2>
<p>A slide out panel can be used for various ways. Its uses depend on the requirement of the site. One may use it for a slide out login box or for just listing the subscribing options for the site. We are going to assume a scenario where we want a subscribe option for the viewers on the top right hand corner of the screen:</p>
<p><a href="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/14321_final-preview.jpg"><img class="size-full wp-image-18510 aligncenter" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/14321_final-preview.jpg" alt="Final output after the coding is complete" width="550" height="346" /></a></p>
<p>Now once the viewer hovers over the subscribe button on the top right hand corner, the whole hidden panel will come sliding down with a very smooth animation effect revealing the subscribing options to the visitor.</p>
<p><a href="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/ac215_after-hover.jpg"><img class="aligncenter size-full wp-image-18512" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/ac215_after-hover.jpg" alt="On hovering over the subscribe button, the slide out effect" width="550" height="337" /></a></p>
<h2>Step 2: Creating the xHTML skeleton</h2>
<p>Now that we know what we want to achieve, lets plan out how the xHTML architecture of the whole layout is going to be.  We would basically need two parts of the layout. One part will be the top one, which will be our hidden panel and will contain the subscribing options. The second part will be the main content area for the whole layout. This area will contain everything which will be visible to the viewer. Here is how our code for the website layout is going to be:</p>
<pre>
&lt;!--&lt;span class=&quot;hiddenSpellError&quot; pre=&quot;&quot;--&gt;DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta content=&quot;text/html; charset=utf-8&quot; http-equiv=&quot;Content-Type&quot; /&gt;
&lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=EmulateIE7&quot; /&gt;
&lt;link href=&quot;css/styles.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
&lt;/head&gt;

&lt;body&gt;
	&lt;div id=&quot;slide-out&quot;&gt;
		&lt;div id=&quot;subscribe&quot; class=&quot;page-wrap&quot;&gt;
			&lt;ul&gt;

	&lt;li&gt;&lt;a class=&quot;&lt;span class=&quot;&gt;rss&lt;/a&gt;&lt;/li&gt;
&lt;a class=&quot;&lt;span class=&quot;&gt;&quot; href=&quot;#&quot;&gt;RSS&lt;/a&gt;
				&lt;li &gt;&lt;a class=&quot;fb&quot; href=&quot;#&quot;&gt;Facebook&lt;/a&gt;&lt;/li&gt;
				&lt;li&gt;&lt;a class=&quot;twitter&quot; href=&quot;#&quot;&gt;Twitter&lt;/a&gt;&lt;/li&gt;
				&lt;li&gt;&lt;a class=&quot;mail&quot; href=&quot;#&quot;&gt;Mail&lt;/a&gt;&lt;/li&gt;
			&lt;/ul&gt;
			&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
			&lt;a href=&quot;#&quot; class=&quot;button&quot;&gt;Subscribe!&lt;/a&gt;
		&lt;/div&gt;
	&lt;/div&gt;
	&lt;div id=&quot;main-container&quot;&gt;
		&lt;div  class=&quot;page-wrap&quot;&gt;
			&lt;h1&gt;CSS3 : The Future is Near!
			&lt;h3&gt;Hover over the subscribe button to see the cool slide effect created by using CSS3 purely.&lt;small&gt;Best viewed on Chrome and Safari&lt;/small&gt;
Integer eu nunc in eros lobortis blandit. Suspendisse potenti.
Nunc porta tellus nec velit vehicula sodales. Aliquam vel grav
		&lt;/div&gt;
	&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>The body is divided into two parts, the <strong>slide-out</strong> and the<br />
<strong>main-container</strong>. The slide out division contains the subscribe links along with the subscribe hyperlink button. Note that we have given a <strong>class</strong> of <strong>button</strong> to the subscribe hyperlink. The main container contains all the sites main text and information. Both the slide-out division and the main container division are assigned a<br />
<strong>page wrap</strong> class to keep them aligned centered in the screen.</p>
<h2>Step 3: Styling the basic layout</h2>
<p>The style-sheet just contains some simple styling of the page. As explained above, there will be one slide-out division, one main container and one page-wrap class. These forms the basic styling elements of our page which give it the look we want.</p>
<p><a href="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/587f4_css-layout1.jpg"><img class="aligncenter size-full wp-image-18524" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/587f4_css-layout1.jpg" alt="CSS Layout of the whole page" width="550" height="384" /></a></p>
<p>The CSS for styling the basic layout of the page is as follows:</p>
<pre>
@import url('reset.css');
body{
	color: #484848;
	background-color: #f7f7f7;
}
.clear {
	clear: both;
}
h1{
	font-size: 58px;
	margin-bottom: 25px;
	height: 68px;
}
h3{
	font-size: 22px;
	margin-bottom: 25px;
}
p{
	text-align: left;
	margin-bottom: 20px;
}
#slide-out {
	background-color: #686868;
	height: 73px;
	color: #fff;
	position: relative ;
	padding-top: 25px;
}
.page-wrap {
	position: relative;
	margin-right: auto;
	margin-left: auto;
	width: 635px;
}
#main-container{
	border-top:thick solid #484848;
	padding-top: 60px;
	text-align: center;
}
.button{
	background-image:url(&quot;../images/button.png&quot;);
	color:#FFFFFF;
	display:block;
	font-size:18px;
	height:28px;
	padding-top:5px;
	text-align:center;
	text-decoration:none;
	width:105px;
}
#subscribe ul li a{
	background-repeat:no-repeat;
	display:block;
	float:left;
	font-size:24px;
	height:38px;
	margin: 0px 20px;
	padding: 10px 0px 0px 55px;
	color: #d3d3d3;
	text-decoration: none;
	line-height: normal;
}
#subscribe ul li a:hover{
	color: #fff;
}
.rss{
	background-image: url('../images/rss.png');
}
.fb{
	background-image: url('../images/facebook.png');
}
.twitter{
	background-image: url('../images/twitter.png');
}
.mail{
	background-image: url('../images/mail-rss.png');
	margin: 0px;
}
</pre>
<p>After we have applied the basic styling to our page, it would look somewhat like this</p>
<p><a href="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/6fa67_after-basic.jpg"><img class="aligncenter size-full wp-image-18525" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/6fa67_after-basic.jpg" alt="After the basic CSS has been applied to the HTML structure" width="550" height="419" /></a></p>
<p>Now that the basic styling of the page is done, we have to set the stage for the panel to hide and show. To achieve that, the first thing we need to do is get the subscribe hyperlink to the bottom right corner of the slide-out division such that it is just peeping out of it. To do this, we have to manipulate the button class in the style-sheet a bit. We are going to make its <strong>positioning absolute</strong> and then give its <strong>right</strong> attribute a value of <strong>0px</strong>. This will push the subscribe button to the right of the division as shown in the image below.</p>
<p><a href="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/1519f_subsribe-right-push.jpg"><img class="aligncenter size-full wp-image-18526" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/1519f_subsribe-right-push.jpg" alt="Pushing the Subscribe right buttons of the slide out panels to the right" width="550" height="95" /></a></p>
<p>Now we have to just push it down such that it sticks to the foot of the slide-out division. To do that we just have to assign a<br />
<strong>negative 63px</strong> value to the <strong>bottom</strong> attribute.</p>
<p><a href="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/dbf41_subscribe-button-pos.jpg"><img class="aligncenter size-full wp-image-18527" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/dbf41_subscribe-button-pos.jpg" alt="Subscribe Button Position" width="550" height="95" /></a></p>
<p>Now that our subscribe button is at its proper place, all we have to do is push the slide-out div out of the screen. To do this, all we have to do is assign a <strong>negative margin</strong> equivalent to the <strong>height</strong> of the slide-out div. To prevent the step down bug in IE6, we also have to assign a <strong>line-height</strong> value of <strong>0 px</strong> to the container of our subscribe links i.e. the subscribe box. To negate the <strong>0</strong> line height on the hyperlink elements, we have to assign a <strong>normal</strong> line height to them too. After modifying our button class, the slide-out id, the subscribe link elements and the subscribe id styles, they will now look like this:</p>
<pre>
#slide-out {
	background-color: #686868;
	height: 73px;
	color: #fff;
	position: relative ;
	padding-top: 25px;
	margin-top: -98px;
}
#subscribe{
	line-height: 0px;
}
.button{
	background-image:url(&quot;../images/button.png&quot;);
	bottom:-63px;
	color:#FFFFFF;
	display:block;
	font-size:18px;
	height:28px;
	padding-top:5px;
	position:absolute;
	right:0;
	text-align:center;
	text-decoration:none;
	width:105px;
	z-index:100;
	line-height: normal;
}
#subscribe ul li a{
	background-repeat:no-repeat;
	display:block;
	float:left;
	font-size:24px;
	height:38px;
	margin: 0px 20px;
	padding: 10px 0px 0px 55px;
	color: #d3d3d3;
	text-decoration: none;
	line-height: normal;
}
</pre>
<p>We all hate Internet Explorer 6 a lot because we always have to add some extra code especially for it. In this case also we would have to do the same. To make the layout look the same as in the other browsers, we have to add some IE6 specific styling at the top of our html page, in the head section.</p>
<pre>
&lt;!--[if IE]&gt;
&lt;style&gt;
#slide-out {
	padding-top: 10px;
}
.button{
	bottom:-64px;
}
#subscribe ul li a{
	margin: 0px 15px;
	padding: 10px 0px 0px 55px;
}
#slide-out{
	margin-top: -83px;
}
&lt;/style&gt;
&lt;!--[&lt;span class=&quot;hiddenSpellError&quot; pre=&quot;&quot;&gt;endif&lt;/span&gt;]--&gt;
</pre>
<p>Now that the slide-out panel is hidden, our task is to enable the <strong>hover</strong> event on the subscribe button such that the slide-out div reveals itself from the top of the page. You might ask why we have put the subscribe link in the slide-out panel and pushed it outside into the main container, rather than placing it in the main container itself.</p>
<p>The reason behind it is that, we have assigned a negative margin to the slide-out div and pushed it out of the screen. To make it visible again, we have allotted a hover event on it which makes it margin back to <strong>0</strong>. As the slide-out div is out of the screen, so it is a difficult process to hover over it. Now because the subscribe hyperlink is actually inside the slide-out div, hence hovering over the subscribe link also acts as a hover event of the slide-out dive making its <strong>top-margin 0</strong> and revealing it.</p>
<p>We can imagine the slide-out div to be a person who is hiding and just his hand is visible to us. When we touch the hand, the person comes out. The hover event which will make the slide-out div pop out of the top of the browser on hovering over the subscribe button will be as follows</p>
<pre>
#slide-out:hover{
	margin-top: 0px;
}
</pre>
<h2>Step 4: The CSS3 Factor!</h2>
<p>We are almost at the end of our tutorial. The hover event is set. The slide-out div reveals itself when we hover over the subscribe button. But the whole process happens without any animation effect. The only thing required now is to spice up the whole thing with a pinch of CSS3.Using the <strong>transition</strong> property in CSS3 we will make the effect as a smooth animation rather than the abrupt effect it has right now. We will give the transition property in the <strong> slide-out</strong> id style as we are changing its styling on hover. After modifying the slide-out id style, it will look like this:</p>
<pre>

#slide-out {
	-moz-transition: all 1s ease-in-out;
	-webkit-transition: all 1s ease-in-out;
	-o-transition: all 1s ease-in-out;
	transition: all 1s ease-in-out;
	background-color: #686868;
	height: 73px;
	color: #fff;
	position: relative;
	padding-top: 25px;
	margin-top: -98px;
}
</pre>
<p>You can change the animation speed by changing the transition speed which is set to 1s at present. This completes our task of enabling a smooth slide out panel from the top of our page without using any javascript.</p>
<hr />
<h2>The Drawbacks</h2>
<p>The main drawback of this method at present is that CSS3 transition effect is only supported by <strong>webkit</strong> browsers like Google&#8217;s Chrome, Apple&#8217;s Safari and Opera. Even though the slide-out panel on hover would work on other browsers like Firefox and Internet Explorer, but the animation wont work in them. The other drawback is that it wont work on Internet Explorer 6.0 because it doesn&#8217;t support the CSS hover event. But there is obviously a <a target="_blank" href="http://www.xs4all.nl/~peterned/csshover.html">solution</a> for this.</p>
<hr />
<h2>Conclusion</h2>
<p>This trick just displays how we can use CSS3 to replace some of the major effects provided by JavaScript libraries like jQuery and MooTools. I believe that with time, these basic transition effects will be replaced with CSS3 transition only. It makes the rendering faster and the load time also decreases as the JavaScript libraries plug-ins are not required. There are many ways of creating a slide out panel and JavaScript libraries really take this to a very high level and provide more functionality than just animation effect. There are many tutorials out there which guide you to create a slide out panel like that using jQuery and CSS together. For further reading related to slide out panels using JavaScript, you can refer to these awesome tutorials</p>
<ul>
<li><a target="_blank" href="http://net.tutsplus.com/tutorials/javascript-ajax/build-a-top-panel-with-jquery/">Build a top panel with jquery</a></li>
<li><a target="_blank" href="http://www.webdesignerwall.com/tutorials/jquery-tutorials-for-designers/">Simple slide panel</a></li>
<li><a target="_blank" href="http://www.ultramegatech.com/blog/2009/06/create-a-slide-in-panel-jquery/">Create a Slide-in Panel with jQuery</a></li>
<li><a target="_blank" href="http://spyrestudios.com/how-to-create-a-sexy-vertical-sliding-panel-using-jquery-and-css3/">How to create a sexy vertical sliding panel using jquery and CSS3</a></li>
<li><a target="_blank" href="http://web-kreation.com/all/nice-clean-sliding-login-panel-built-with-jquery/">Nice clean sliding login panel built with jquery</a></li>
</ul>
<div>
<a href="http://feeds.feedburner.com/~ff/1stwebdesigner?a=hlp_0ZpwU5c:U_nSf8eyT9s:yIl2AUoC8zA"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/dbf41_1stwebdesigner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/1stwebdesigner?a=hlp_0ZpwU5c:U_nSf8eyT9s:7Q72WNTAKBA"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/dbf41_1stwebdesigner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/1stwebdesigner?a=hlp_0ZpwU5c:U_nSf8eyT9s:F7zBnMyn0Lo"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/dbf41_1stwebdesigner?i=hlp_0ZpwU5c:U_nSf8eyT9s:F7zBnMyn0Lo" border="0"></img></a>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/74029_hlp_0ZpwU5c" height="1" width="1" /><br />
<a href="http://www.1stwebdesigner.com/feed/">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/blogposter/web-resources/how-to-create-a-cool-slide-out-panel-with-css3-only/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WebKit-Specific Style:&#160;-webkit-appearance</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/webkit-specific-style-webkit-appearance/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/webkit-specific-style-webkit-appearance/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 23:00:18 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[web resources]]></category>
		<category><![CDATA[david walsh]]></category>
		<category><![CDATA[element view]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google homepage]]></category>
		<category><![CDATA[html element]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[span class]]></category>
		<category><![CDATA[style buttons]]></category>
		<category><![CDATA[style definition]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/webkit-specific-style-webkit-appearance/</guid>
		<description><![CDATA[I was recently scoping out the horrid source code of the Google homepage when I noticed the &#8220;Google Search&#8221; and &#8220;I&#8217;m Feeling Lucky&#8221; buttons had a style definition I hadn&#8217;t seen before:  -webkit-appearance.  The value assigned to the style was &#8220;push-button.&#8221;  They are buttons so that makes sense but I was curious as to the [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently scoping out the horrid source code of the Google homepage when I noticed the &#8220;Google Search&#8221; and &#8220;I&#8217;m Feeling Lucky&#8221; buttons had a style definition I hadn&#8217;t seen before:  -webkit-appearance.  The value assigned to the style was &#8220;push-button.&#8221;  They are buttons so that makes sense but I was curious as to the possible values available for that style.  What I found was that there are a *ton* and that you can set any HTML element to look like a completely different element.</p>
<div><a href="http://davidwalsh.name/dw-content/webkit-styles.php">View Demo</a>
<div></div>
</div>
<h2>Possible -webkit-appearance Values</h2>
<ul>
<li>checkbox</li>
<li>radio</li>
<li>push-button</li>
<li>square-button</li>
<li>button</li>
<li>button-bevel</li>
<li>listbox</li>
<li>listitem</li>
<li>menulist</li>
<li>menulist-button</li>
<li>menulist-text</li>
<li>menulist-textfield</li>
<li>scrollbarbutton-up</li>
<li>scrollbarbutton-down</li>
<li>scrollbarbutton-left</li>
<li>scrollbarbutton-right</li>
<li>scrollbartrack-horizontal</li>
<li>scrollbartrack-vertical</li>
<li>scrollbarthumb-horizontal</li>
<li>scrollbarthumb-vertical</li>
<li>scrollbargripper-horizontal</li>
<li>scrollbargripper-vertical</li>
<li>slider-horizontal</li>
<li>slider-vertical</li>
<li>sliderthumb-horizontal</li>
<li>sliderthumb-vertical</li>
<li>caret</li>
<li>searchfield</li>
<li>searchfield-decoration</li>
<li>searchfield-results-decoration</li>
<li>searchfield-results-button</li>
<li>searchfield-cancel-button</li>
<li>textfield</li>
<li>textarea</li>
</ul>
<h2>The HTML</h2>
<pre>
&lt;span class="webkit-me"&gt;My Span Tag&lt;/span&gt;
</pre>
<p>Just a SPAN tag, right?  We&#8217;ll see about that.</p>
<h2>The CSS</h2>
<pre>
.webkit-me { -webkit-appearance:push-button; }
</pre>
<p>Now my span looks like a button.  Weird, huh?  It can get worse:</p>
<pre>
.webkit-me { -webkit-appearance:checkbox; }
</pre>
<p>That&#8217;s right&#8230;my SPAN tag now looks like checkbox.  Weird.</p>
<div><a href="http://davidwalsh.name/dw-content/webkit-styles.php">View Demo</a>
<div></div>
</div>
<p>Be sure to check out my demo &#8212; I&#8217;ve got each -webkit-appearance setting represented.  Some elements show no change but some look downright odd!</p>
<p><strong>Follow Me!</strong> <a href="http://twitter.com/davidwalshblog">Twitter</a> | <a href="http://www.facebook.com/#!/pages/David-Walsh-Blog/186644584869">Facebook</a> | <a href="http://www.linkedin.com/in/davidjameswalsh">LinkedIn</a> | <a href="http://mootools.net/forge/profile/davidwalsh">MooTools Forge.</a></p>
<p>Full David Walsh Blog Post: <a href="http://davidwalsh.name/webkit-appearance">WebKit-Specific Style:&nbsp;-webkit-appearance</a></p>
<p>Related posts:
<ol>
<li><a href="http://davidwalsh.name/rounded-corners-webkit" rel="bookmark" title="Permanent Link: Rounded Corners in Webkit">Rounded Corners in&nbsp;Webkit</a></li>
<li><a href="http://davidwalsh.name/dojo-twitter" rel="bookmark" title="Permanent Link: Create Twitter-Style Buttons with the Dojo Toolkit">Create Twitter-Style Buttons with the Dojo&nbsp;Toolkit</a></li>
<li><a href="http://davidwalsh.name/mootools-style-media" rel="bookmark" title="Permanent Link: MooTools: Set Style Per Media">MooTools: Set Style Per&nbsp;Media</a></li>
<li><a href="http://davidwalsh.name/dojo-browser-styles" rel="bookmark" title="Permanent Link: Browser-Specific Styles with the Dojo Toolkit">Browser-Specific Styles with the Dojo&nbsp;Toolkit</a></li>
<li><a href="http://davidwalsh.name/github-css" rel="bookmark" title="Permanent Link: Create GitHub-Style Buttons with CSS and jQuery, MooTools, or Dojo JavaScript">Create GitHub-Style Buttons with CSS and jQuery, MooTools, or Dojo&nbsp;JavaScript</a></li>
</ol>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/fdf59_Eok7kSl70rY" height="1" width="1" /><br />
<a href="http://davidwalsh.name/feed/atom">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/webkit-specific-style-webkit-appearance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Build a Distance Finder with Google Maps API</title>
		<link>http://www.neurosoftware.ro/programming-blog/blogposter/web-resources/how-to-build-a-distance-finder-with-google-maps-api/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/blogposter/web-resources/how-to-build-a-distance-finder-with-google-maps-api/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 16:00:14 +0000</pubDate>
		<dc:creator>BlogPoster</dc:creator>
				<category><![CDATA[web resources]]></category>
		<category><![CDATA[amp nbsp]]></category>
		<category><![CDATA[distance finder]]></category>
		<category><![CDATA[google map]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[input boxes]]></category>
		<category><![CDATA[plotting points]]></category>
		<category><![CDATA[quickest route]]></category>
		<category><![CDATA[span class]]></category>
		<category><![CDATA[td colspan]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/blogposter/web-resources/how-to-build-a-distance-finder-with-google-maps-api/</guid>
		<description><![CDATA[Google maps is a free web mapping service application provided by Google. It offers lots of cool features (showing various map types, plotting points, showing routes, geocoding addresses). You can also add all these features to your website using the Google Maps APIs provided by Google. In this tutorial I will show you how to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/ecab6_how-to-add-google-maps-to-website.jpg"><img class="alignleft size-full wp-image-17417" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/ecab6_how-to-add-google-maps-to-website.jpg" alt="" width="150" height="150" /></a><a href="http://maps.google.com" target="_blank">Google maps</a> is a free web mapping service application provided by Google. It offers lots of cool features (showing various map types, plotting points, showing routes, geocoding addresses). You can also add all these features to your website using the Google Maps APIs provided by Google. In this tutorial I will show you how to add some of these features to your site. I will be using the <a href="http://code.google.com/apis/maps/documentation/javascript/" target="_blank">Google Maps Javascript API v3</a> (the newest version).<span></span></p>
<h3>What are we going to build?</h3>
<p>We&#8217;ll make a distance finder. We&#8217;ll add a Google map to our site, plot two points on it (the user will be able to choose the addresses for these points), compute the distance between them and show the quickest route between them.</p>
<p>You can see the demo of application <a href="http://www.1stwebdesigner.com/wp-content/uploads/2010/06/distance-finder/source-distance-finder-google-maps.php" target="_blank">here</a>. Also, you can download the source code using <a href="http://www.1stwebdesigner.com/wp-content/uploads/2010/06/distance-finder-google-maps.zip" target="_blank">this link</a>.</p>
<h3>Prerequisites</h3>
<p>The first thing you need to do in order to use the API from Google is requesting an API key. You can do this <a href="http://code.google.com/apis/maps/signup.html" target="_blank">here</a>. It&#8217;s easy and free!</p>
<h3>Creating the web form for getting the two addresses</h3>
<p>We&#8217;ll create a simple html form for the user to write the two addresses. We&#8217;ll add two input boxes and a button to the form. When the user presses the &#8220;Show&#8221; button, the map with the two locations will be shown.</p>
<p>Here&#8217;s the code for this:</p>
<pre>
&lt;table align=&quot;center&quot; valign=&quot;center&quot;&gt;
&lt;tr&gt;
   &lt;td colspan=&quot;7&quot; align=&quot;center&quot;&gt;&lt;b&gt;Find the distance between two locations&lt;/b&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
   &amp;nbsp;
&lt;/tr&gt;
&lt;tr&gt;
   &lt;td&gt;First address:&lt;/td&gt;
   &amp;nbsp;
   &lt;input name=&quot;&lt;span class=&quot; type=&quot;text&quot; /&gt;address1&quot; id=&quot;address1&quot; size=&quot;50&quot;/&gt;
   &amp;nbsp;
   &lt;td&gt;Second address:&lt;/td&gt;
   &amp;nbsp;
   &lt;input name=&quot;&lt;span class=&quot; type=&quot;text&quot; /&gt;address2&quot; id=&quot;address2&quot; size=&quot;50&quot;/&gt;
&lt;/tr&gt;
&lt;tr&gt;
   &amp;nbsp;
&lt;/tr&gt;
&lt;tr&gt;
   &lt;td colspan=&quot;7&quot; align=&quot;center&quot;&gt;&lt;input type=&quot;button&quot; value=&quot;Show&quot; onclick=&quot;initialize();&quot;/&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
</pre>
<p>The &#8216;initialize&#8217; JavaScript function will be called when pressing the button. The function will show the map. In the next section I&#8217;ll show you how.</p>
<p>We also need to add a div tag to our page, where the map will be shown:</p>
<pre>&lt;div id=&quot;map_canvas&quot; style=&quot;width:70%; height:54%&quot;&gt;&lt;/div&gt;</pre>
<p>We will also need two div tags for showing the distances we will compute:</p>
<pre>&lt;div style=&quot;width:100%; height:10%&quot; id=&quot;distance_direct&quot;&gt;&lt;/div&gt;
&lt;div style=&quot;width:100%; height:10%&quot; id=&quot;distance_road&quot;&gt;&lt;/div&gt;</pre>
<p><code> </code></p>
<h3>Showing the map</h3>
<p>The first thing we need to do is to find the coordinates (latitude and longitude) for the two addresses. Luckily, Google Maps will help us! Here&#8217;s what we have to do:</p>
<p>We&#8217;ll use the geocoder object for this. First, we&#8217;ll have to create a new geocoder object.</p>
<pre>geocoder = new google.maps.Geocoder();</pre>
<p>After this, we&#8217;ll get the two address values from the form. Like this:</p>
<pre>address1 = document.getElementById(&quot;address1&quot;).value;
address2 = document.getElementById(&quot;address2&quot;).value;</pre>
<p>Then, we&#8217;ll use the following code to call the geocode method on the geocoder object. We&#8217;ll pass it the addresses one by one and save the results in the variables called location1 and location2 (these will hold the coordinates of the two addresses).</p>
<pre>if (geocoder)
{
   geocoder.geocode( { 'address': address1}, function(results, status)
   {
      if (status == google.maps.GeocoderStatus.OK)
      {
         //location of first address (latitude + longitude)
         location1 = results[0].geometry.location;
      } else
      {
         alert(&quot;Geocode was not successful for the following reason: &quot; + status);
      }
   });
   geocoder.geocode( { 'address': address2}, function(results, status)
   {
      if (status == google.maps.GeocoderStatus.OK)
      {
         //location of second address (latitude + longitude)
         location2 = results[0].geometry.location;
         // calling the showMap() function to create and show the map
         showMap();
      } else
      {
        alert(&quot;Geocode was not successful for the following reason: &quot; + status);
      }
   });
}</pre>
<p>You will notice that we&#8217;ve called the showMap() function when the coordinates for the second address are retrieved. This function will set the options for the map and show it.</p>
<p>We&#8217;ll now compute the coordinates for the center of the map. The center point will be between our two points.</p>
<pre>latlng = new google.maps.LatLng((location1.lat()+location2.lat())/2,(location1.lng()+location2.lng())/2);</pre>
<p>Next, we&#8217;ll show the map. We have to create a new map object and pass it some parameters (set using the mapOptions variable): the zoom level, the center and the type of the map.</p>
<pre>var mapOptions =
{
   zoom: 1,
   center: latlng,
   mapTypeId: google.maps.MapTypeId.HYBRID
};

map = new google.maps.Map(document.getElementById(&quot;map_canvas&quot;), mapOptions);</pre>
<p>The next thing we&#8217;ll do is to show the quickest route between our locations. We&#8217;ll use a DirectionsService object from google maps for this. Here&#8217;s how the code looks:</p>
<pre>directionsService = new google.maps.DirectionsService();
directionsDisplay = new google.maps.DirectionsRenderer(
{
   suppressMarkers: true,
   suppressInfoWindows: true
});
directionsDisplay.setMap(map);
var request = {
   origin:location1,
   destination:location2,
   travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status)
{
   if (status == google.maps.DirectionsStatus.OK)
   {
      directionsDisplay.setDirections(response);
      distance = &quot;The distance between the two points on the chosen route is: &quot;+response.routes[0].legs[0].distance.text;
      distance += &quot;The aproximative driving time is: &quot;+response.routes[0].legs[0].duration.text;
      document.getElementById(&quot;distance_road&quot;).innerHTML = distance;
   }
});</pre>
<p>We&#8217;ve first created the objects we need. We then set some options for displaying the route, we&#8217;ve chosen not to show markers and info boxes (we&#8217;ll create our own ones);</p>
<pre>suppressMarkers: true,
suppressInfoWindows: true</pre>
<p>We&#8217;ve created a request object and set the origin and destination for the route and also the travel mode:</p>
<pre>var request = {
   origin:location1,
   destination:location2,
   travelMode: google.maps.DirectionsTravelMode.DRIVING
};</pre>
<p>We&#8217;ve then called the route function and obtained a response from the server. Using this response we&#8217;ve plotted the route on the map and written some info (the total distance and aproximative driving time) in one of the divs we&#8217;ve created:</p>
<pre>directionsDisplay.setDirections(response);
distance = &quot;The distance between the two points on the chosen route is: &quot;+response.routes[0].legs[0].distance.text;
distance += &quot;The aproximative driving time is: &quot;+response.routes[0].legs[0].duration.text;
document.getElementById(&quot;distance_road&quot;).innerHTML = distance;</pre>
<p>We&#8217;ll also show a line between our points and compute the distance between them (the distance on a straight line, in kilometers). To show a line we&#8217;ll use a Polyline object from google maps and set some options for it (the map it belongs to, the path, the width, the opacity and the color):</p>
<pre>var line = new google.maps.Polyline({
   map: map,
   path: [location1, location2],
   strokeWeight: 7,
   strokeOpacity: 0.8,
   strokeColor: &quot;#FFAA00&quot;
});</pre>
<p>We&#8217;ll now compute the distance between two points using their coordinates and show the result inside the other div tag we&#8217;ve created.</p>
<pre>var R = 6371;
var dLat = toRad(location2.lat()-location1.lat());
var dLon = toRad(location2.lng()-location1.lng());
var dLat1 = toRad(location1.lat());
var dLat2 = toRad(location2.lat());
var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
        Math.cos(dLat1) * Math.cos(dLat1) *
        Math.sin(dLon/2) * Math.sin(dLon/2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
var d = R * c;

document.getElementById(&quot;distance_direct&quot;).innerHTML = &quot;The distance between the two points (in a straight line) is: &quot;+d;</pre>
<p>The last thing we&#8217;ll do is show a marker and an info window for each location. We&#8217;ll create two marker objects (the options we&#8217;ll set are: the map it belongs to, the coordinates and a title):</p>
<pre>var marker1 = new google.maps.Marker({
   map: map,
   position: location1,
   title: &quot;First location&quot;
});

var marker2 = new google.maps.Marker({
   map: map,
   position: location2,
   title: &quot;Second location&quot;
});</pre>
<p>Next, we&#8217;ll create variables to hold the texts to print in the info windows, create two info window objects (we&#8217;ll add the texts to them using the content option) and we&#8217;ll add two event listeners which will show the appropriate info window when the user clicks on the markers:</p>
<pre>// create the text to be shown in the infowindows

var text1 = '
&lt;div id=&quot;content&quot;&gt;'+&lt;/div&gt;
  '&lt;h1 id=&quot;firstHeading&quot;&gt;First location'+
  '&lt;div id=&quot;bodyContent&quot;&gt;'+
  '&lt;p&gt;Coordinates: '+location1+'&lt;/p&gt;'+
  '&lt;p&gt;Address: '+address1+'&lt;/p&gt;'+
  '&lt;/div&gt;'+
  '&lt;/div&gt;';

var text2 = '
&lt;div id=&quot;content&quot;&gt;'+&lt;/div&gt;
  '&lt;h1 id=&quot;firstHeading&quot;&gt;Second location'+
  '&lt;div id=&quot;bodyContent&quot;&gt;'+
  '&lt;p&gt;Coordinates: '+location2+'&lt;/p&gt;'+
  '&lt;p&gt;Address: '+address2+'&lt;/p&gt;'+
  '&lt;/div&gt;'+
  '&lt;/div&gt;';

// create info boxes for the two markers
var infowindow1 = new google.maps.InfoWindow({
   content: text1
});
var infowindow2 = new google.maps.InfoWindow({
   content: text2
});

// add action events so the info windows will be shown when the marker is clicked
google.maps.event.addListener(marker1, 'click', function() {
   infowindow1.open(map,marker1);
});

google.maps.event.addListener(marker2, 'click', function() {
   infowindow2.open(map,marker2);
});</pre>
<p>And we&#8217;re done! We now have a distance finder! Let me know if you have any questions!</p>
<div>
<a href="http://feeds.feedburner.com/~ff/1stwebdesigner?a=7tI2U6hkEVc:dj-cPv8-HkY:yIl2AUoC8zA"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/e6ed8_1stwebdesigner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/1stwebdesigner?a=7tI2U6hkEVc:dj-cPv8-HkY:7Q72WNTAKBA"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/e6ed8_1stwebdesigner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/1stwebdesigner?a=7tI2U6hkEVc:dj-cPv8-HkY:F7zBnMyn0Lo"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/e6ed8_1stwebdesigner?i=7tI2U6hkEVc:dj-cPv8-HkY:F7zBnMyn0Lo" border="0"></img></a>
</div>
<p><a href="http://www.1stwebdesigner.com/feed/">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/blogposter/web-resources/how-to-build-a-distance-finder-with-google-maps-api/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Quick Tip: Practical CSS Shapes</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/quick-tip-practical-css-shapes/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/quick-tip-practical-css-shapes/#comments</comments>
		<pubDate>Fri, 14 May 2010 02:18:43 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[web resources]]></category>
		<category><![CDATA[div id]]></category>
		<category><![CDATA[doctype html]]></category>
		<category><![CDATA[html lang]]></category>
		<category><![CDATA[linear gradient]]></category>
		<category><![CDATA[meta charset]]></category>
		<category><![CDATA[sans serif]]></category>
		<category><![CDATA[span class]]></category>
		<category><![CDATA[tiny images]]></category>
		<category><![CDATA[white arrow]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/quick-tip-practical-css-shapes/</guid>
		<description><![CDATA[A common design technique lately is to create a fold effect, where it appears as if a heading is wrapping behind its container. This is generally achieved through the use of tiny images; however, with CSS, we can mimic this effect quite easily. I&#8217;ll show you how in four minutes. Subscribe to our YouTube page [...]]]></description>
			<content:encoded><![CDATA[<p>
 A common design technique lately is to create a fold effect, where it appears as if a heading is wrapping behind its container. This is generally achieved through the use of tiny images; however, with CSS, we can mimic this effect quite easily. I&#8217;ll show you how in four minutes.
</p>
<p><span></span></p>
<div>
<br />
<span><a href="http://www.youtube.com/user/nettutsplus">Subscribe to our YouTube page to watch all of the video tutorials!</a></span></p>
<p><a href="http://screenr.com/Y1p">Rather watch on Screenr.com?</a></em></p>
</div>
<div><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/385d3_example.jpg" alt="Example" />
</div>
<hr />
<h2> Final HTML </h2>
<pre>
&lt;!DOCTYPE html&gt;

&lt;html lang="en"&gt;
&lt;head&gt;
	&lt;meta charset="utf-8"&gt;
	&lt;title&gt;CSS Shapes&lt;/title&gt;

	&lt;!--[if IE]&gt;
		&lt;style&gt;
			.arrow { top: 100%; }
		&lt;/style&gt;
	&lt;![endif]--&gt;

&lt;/head&gt;
&lt;body&gt;
	 &lt;div id="container"&gt;

		&lt;h1&gt; My Heading &lt;span class="arrow"&gt;&lt;/span&gt; &lt;/h1&gt;

	&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<hr />
<h2> Final CSS </h2>
<pre>
#container {
	background: #666;
	margin: auto;
	width: 500px;
	height: 700px;
	padding-top: 30px;
	font-family: helvetica, arial, sans-serif;
	}

h1 {
	 background: #e3e3e3;
	 background: -moz-linear-gradient(top, #e3e3e3, #c8c8c8);
	 background: -webkit-gradient(linear, left top, left bottom, from(#e3e3e3), to(#c8c8c8));
	 padding: 10px 20px;
	 margin-left: -20px;
	 margin-top: 0;
	 position: relative;
	 width: 70%;

	-moz-box-shadow: 1px 1px 3px #292929;
	-webkit-box-shadow: 1px 1px 3px #292929;
       box-shadow: 1px 1px 3px #292929;

	color: #454545;
	text-shadow: 0 1px 0 white;
}

.arrow {
	 width: 0; height: 0;
	 line-height: 0;
	 border-left: 20px solid transparent;
	 border-top: 10px solid #c8c8c8;
	 top: 104%;
	 left: 0;
	 position: absolute;
}
</pre>
<p><a href="http://feedads.g.doubleclick.net/~a/tPKv2A4Xo_xW8WXmxklmA8_tb6g/0/da"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/385d3_di" border="0"></img></a><br />
<a href="http://feedads.g.doubleclick.net/~a/tPKv2A4Xo_xW8WXmxklmA8_tb6g/1/da"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/385d3_di" border="0"></img></a></p>
<div>
<a href="http://feeds.feedburner.com/~ff/nettuts?a=iZKey3yivyU:9QVxGannJus:yIl2AUoC8zA"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/385d3_nettuts?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=iZKey3yivyU:9QVxGannJus:F7zBnMyn0Lo"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/00021_nettuts?i=iZKey3yivyU:9QVxGannJus:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=iZKey3yivyU:9QVxGannJus:V_sGLiPBpWU"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/00021_nettuts?i=iZKey3yivyU:9QVxGannJus:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=iZKey3yivyU:9QVxGannJus:gIN9vFwOqvQ"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/00021_nettuts?i=iZKey3yivyU:9QVxGannJus:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=iZKey3yivyU:9QVxGannJus:TzevzKxY174"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/00021_nettuts?d=TzevzKxY174" border="0"></img></a>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/00021_iZKey3yivyU" height="1" width="1" /><br />
<a href="http://wordpress4dummies.info/feed/">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/quick-tip-practical-css-shapes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Yoast: Google &amp; Microformats: Drive More Traffic</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/yoast-google-microformats-drive-more-traffic/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/yoast-google-microformats-drive-more-traffic/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 12:51:38 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[web resources]]></category>
		<category><![CDATA[conversion rate]]></category>
		<category><![CDATA[div class]]></category>
		<category><![CDATA[geographical coordinates]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[html conventions]]></category>
		<category><![CDATA[latitude and longitude]]></category>
		<category><![CDATA[search engine results]]></category>
		<category><![CDATA[span class]]></category>
		<category><![CDATA[st lt]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/yoast-google-microformats-drive-more-traffic/</guid>
		<description><![CDATA[Anyone that has spent time trying to improve their click through rates ( CTR ) from search engine results pages ( SERP s) will tell you that Google algorithmically picks the snippet displayed for a given page; it&#8217;s not something you can always control. Unfortunately, Google doesn&#8217;t always display the snippet that will give you [...]]]></description>
			<content:encoded><![CDATA[<p>Anyone that has spent time trying to improve their click through rates (<br />
 CTR ) from search engine results pages (<br />
 SERP s) will tell you that Google algorithmically picks the snippet displayed for a given page; it&#8217;s not something you can always control. Unfortunately, Google doesn&#8217;t always display the snippet that will give you the best conversion rate.</p>
<p>However, the use of <a rel="nofollow" target="_blank" href="http://microformats.org/">microformats</a>, a set of agreed upon<br />
 HTML conventions used to describe content, can give you more control of the <a rel="nofollow" target="_blank" href="http://www.google.com/support/webmasters/bin/answer.py?answer=99170">snippets</a> displayed in Google<br />
 SERP s. Once your site is properly using <a rel="nofollow" target="_blank" href="http://microformats.org/2009/05/15/rich-snippets-microformat-search">rich snippets</a>, you will see them also appear in your <a rel="nofollow" target="_blank" href="http://www.google.com/cse/">Google custom search</a> and <a rel="nofollow" target="_blank" href="http://www.google.com/sitesearch/">Google site search</a> results, so this technique is definitely worth exploring if you use those tools as well.</p>
<p>The changes are easy to implement for <a rel="nofollow" target="_blank" href="http://wordpress.org/">WordPress</a>, <a rel="nofollow" target="_blank" href="http://www.magentocommerce.com/">Magento</a> and other software, let&#8217;s take a look at some use cases based on <a rel="nofollow" target="_blank" href="http://microformats.org/wiki/hreview">hReview</a>, <a rel="nofollow" target="_blank" href="http://microformats.org/wiki/hcard">hCard</a>, <a rel="nofollow" target="_blank" href="http://microformats.org/wiki/hproduct">hProduct</a> and <a rel="nofollow" target="_blank" href="http://gmpg.org/xfn/">XFN</a>:</p>
<p><strong>Businesses &amp; Organizations:</strong></p>
<table border="0" cellspacing="5" cellpadding="5">
<tr>
<td><em>Property</em></td>
<td><em>Description</em></td>
</tr>
<tr>
<td>name (fn/org)</td>
<td>The name of the business. If you use microformats, you should use both fn and org, and ensure that these have the same value.</td>
</tr>
<tr>
<td>url</td>
<td>Link to a web page on the business&#8217;s site.</td>
</tr>
<tr>
<td>address (adr)</td>
<td>The location of the business. Can contain the sub properties street address, locality, region, postal-code, and country-name.</td>
</tr>
<tr>
<td>tel</td>
<td>The telephone number of the business or organization.</td>
</tr>
<tr>
<td>geo</td>
<td>Specifies the geographical coordinates of the location. Includes two elements: latitude and longitude. Optional.</td>
</tr>
</table>
<p>Could be marked up as follows:</p>
<div>
<div>
<pre><span><span>&lt;div</span> <span>class</span>=<span>"vcard"</span><span>&gt;</span></span> <span><span>&lt;span</span> <span>class</span>=<span>"fn org"</span><span>&gt;</span></span>L'Amourita Pizza<span><span>&lt;/span<span>&gt;</span></span></span> Located at <span><span>&lt;div</span> <span>class</span>=<span>"adr"</span><span>&gt;</span></span> <span><span>&lt;span</span> <span>class</span>=<span>"street-address"</span><span>&gt;</span></span>123 Main St<span><span>&lt;/span<span>&gt;</span></span></span>, <span><span>&lt;span</span> <span>class</span>=<span>"locality"</span><span>&gt;</span></span>Albuquerque<span><span>&lt;/span<span>&gt;</span></span></span>, <span><span>&lt;span</span> <span>class</span>=<span>"region"</span><span>&gt;</span></span>NM<span><span>&lt;/span<span>&gt;</span></span></span>. <span><span>&lt;/div<span>&gt;</span></span></span> <span><span>&lt;span</span> <span>class</span>=<span>"geo"</span><span>&gt;</span></span> <span><span>&lt;span</span> <span>class</span>=<span>"latitude"</span><span>&gt;</span></span> <span><span>&lt;span</span> <span>class</span>=<span>"value-title"</span> <span>title</span>=<span>"37.774929"</span> <span>/&gt;</span></span> <span><span>&lt;/span<span>&gt;</span></span></span> <span><span>&lt;span</span> <span>class</span>=<span>"longitude"</span><span>&gt;</span></span> <span><span>&lt;span</span> <span>class</span>=<span>"value-title"</span> <span>title</span>=<span>"-122.419416"</span> <span>/&gt;</span></span> <span><span>&lt;/span<span>&gt;</span></span></span> <span><span>&lt;/span<span>&gt;</span></span></span> Phone: <span><span>&lt;span</span> <span>class</span>=<span>"tel"</span><span>&gt;</span></span>206-555-1234<span><span>&lt;/span<span>&gt;</span></span></span> <span><span>&lt;a</span> <span>href</span>=<span>"http://pizza.example.com/"</span> <span>class</span>=<span>"url"</span><span>&gt;</span></span>http://pizza.example.com<span><span>&lt;/a<span>&gt;</span></span></span> <span><span>&lt;/div<span>&gt;</span></span></span></pre>
</div>
</div>
<p>Learn more about the business and organization markup at <a rel="nofollow" target="_blank" href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&amp;answer=146861">webmaster central</a>.</p>
<p><strong>Products:</strong></p>
<table border="0" cellspacing="5" cellpadding="5">
<tr>
<td><em>Property</em></td>
<td><em>Description</em></td>
</tr>
<tr>
<td>brand</td>
<td>The brand of the product for example, ACME.</td>
</tr>
<tr>
<td>category</td>
<td>The product category for example, &#8220;Books&mdash;Fiction&#8221;, &#8220;Heavy Objects&#8221;, or &#8220;Cars&#8221;.</td>
</tr>
<tr>
<td>description</td>
<td>Product description</td>
</tr>
<tr>
<td>name (fn)</td>
<td>Product name</td>
</tr>
<tr>
<td>price</td>
<td>Floating point number. Can use currency format.</td>
</tr>
<tr>
<td>photo</td>
<td>URL of product photo</td>
</tr>
<tr>
<td>url</td>
<td>URL of product page</td>
</tr>
</table>
<p>Could be marked up as follows:</p>
<div>
<div>
<pre><span><span>&lt;div</span> <span>class</span>=<span>"hproduct"</span><span>&gt;</span></span> Brand: <span><span>&lt;span</span> <span>class</span>=<span>"brand"</span><span>&gt;</span></span>ACME<span><span>&lt;/span<span>&gt;</span></span></span> <span><span>&lt;span</span> <span>class</span>=<span>"category"</span><span>&gt;</span></span>Heavy objects<span><span>&lt;/span<span>&gt;</span></span></span> <span><span>&lt;h1</span> <span>class</span>=<span>"fn"</span><span>&gt;</span></span>Large all-purpose anvil<span><span>&lt;/h1<span>&gt;</span></span></span> On sale for <span><span>&lt;span</span> <span>class</span>=<span>"price"</span><span>&gt;</span></span>$99.95<span><span>&lt;/span<span>&gt;</span></span></span>. <span><span>&lt;span</span> <span>class</span>=<span>"description"</span><span>&gt;</span></span>If you need an object to drop from a height, the classic A23859 anvil from ACME is the way to go.<span><span>&lt;/span<span>&gt;</span></span></span> <span><span>&lt;a</span> <span>href</span>=<span>"http://anvil.example.com"</span> <span>class</span>=<span>"url"</span><span>&gt;</span></span>Anvil details page<span><span>&lt;/a<span>&gt;</span></span></span>
<span><span>&lt;/div<span>&gt;</span></span></span></pre>
</div>
</div>
<p>Becomes:</p>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/43d94_webmasters_146645_individualimage.png" alt="Individual Product" width="553" height="95" class="aligncenter size-full wp-image-2030" /></p>
<p>Learn more about the product markup at <a rel="nofollow" target="_blank" href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&amp;answer=146750">webmaster central</a>.</p>
<p><strong>People:</strong></p>
<table border="0" cellspacing="5" cellpadding="5">
<tr>
<td><em>Property</em></td>
<td><em>Description</em></td>
</tr>
<tr>
<td>name (fn)</td>
<td>Name</td>
</tr>
<tr>
<td>nickname</td>
<td>Nickname</td>
</tr>
<tr>
<td>photo</td>
<td>An image link</td>
</tr>
<tr>
<td>title</td>
<td>The person&#8217;s title (for example, Financial Manager)</td>
</tr>
<tr>
<td>role</td>
<td>The person&#8217;s role (for example, Accountant)</td>
</tr>
<tr>
<td>url</td>
<td>Link to a web page, such as the person&#8217;s home page</td>
</tr>
<tr>
<td>affiliation (org)</td>
<td>The name of an organization with which the person is associated (for example, an employer). If fn and org have the exact same value, Google will interpret the information as referring to a business or organization, not a person.</td>
</tr>
<tr>
<td>friend</td>
<td>Identifies a social relationship between the person described and another person.</td>
</tr>
<tr>
<td>contact</td>
<td>Identifies a social relationship between the person described and another person.</td>
</tr>
<tr>
<td>acquaintance</td>
<td>Identifies a social relationship between the person described and another person.</td>
</tr>
<tr>
<td>address (adr)</td>
<td>The location of the person. Can have the sub properties street address, city, region, postal-code, and country-name.</td>
</tr>
</table>
<p>Could be marked up as:</p>
<div>
<div>
<pre><span><span>&lt;div</span> <span>class</span>=<span>"vcard"</span><span>&gt;</span></span> My name is <span><span>&lt;span</span> <span>class</span>=<span>"fn"</span><span>&gt;</span></span>Bob Smith<span><span>&lt;/span<span>&gt;</span></span></span>, but people call me <span><span>&lt;span</span> <span>class</span>=<span>"nickname"</span><span>&gt;</span></span>Smithy<span><span>&lt;/span<span>&gt;</span></span></span>. Here is my home page: <span><span>&lt;a</span> <span>href</span>=<span>"http://www.example.com"</span> <span>class</span>=<span>"url"</span><span>&gt;</span></span>www.example.com<span><span>&lt;/a<span>&gt;</span></span></span>. I live in <span><span>&lt;span</span> <span>class</span>=<span>"adr"</span><span>&gt;</span></span> <span><span>&lt;span</span> <span>class</span>=<span>"locality"</span><span>&gt;</span></span>Albuquerque<span><span>&lt;/span<span>&gt;</span></span></span>, <span><span>&lt;span</span> <span>class</span>=<span>"region"</span><span>&gt;</span></span>NM<span><span>&lt;/span<span>&gt;</span></span></span> <span><span>&lt;/span<span>&gt;</span></span></span> and work as an <span><span>&lt;span</span> <span>class</span>=<span>"title"</span><span>&gt;</span></span>engineer<span><span>&lt;/span<span>&gt;</span></span></span> at <span><span>&lt;span</span> <span>class</span>=<span>"org"</span><span>&gt;</span></span>ACME Corp<span><span>&lt;/span<span>&gt;</span></span></span>. My friends: <span><span>&lt;a</span> <span>href</span>=<span>"http://darryl-blog.example.com"</span> <span>rel</span>=<span>"friend"</span><span>&gt;</span></span>Darryl<span><span>&lt;/a<span>&gt;</span></span></span>, <span><span>&lt;a</span> <span>href</span>=<span>"http://edna-blog.example.com"</span> <span>rel</span>=<span>"friend"</span><span>&gt;</span></span>Edna<span><span>&lt;/a<span>&gt;</span></span></span>
<span><span>&lt;/div<span>&gt;</span></span></span></pre>
</div>
</div>
<p>Becomes:</p>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/43d94_webmasters_146676_rspeople.png" alt="People" width="557" height="95" class="aligncenter size-full wp-image-2031" /></p>
<p>Learn more about markup for people at <a rel="nofollow" target="_blank" href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&amp;answer=146646">webmaster central</a>.</p>
<p><strong>Reviews:</strong></p>
<table border="0" cellspacing="5" cellpadding="5">
<tr>
<td><em>Property</em></td>
<td><em>Description</em></td>
</tr>
<tr>
<td>itemreviewed (item)</td>
<td>The item being reviewed. In microformats, can contain the element name (fn).</td>
</tr>
<tr>
<td>rating</td>
<td>A numerical quality rating for the item (for example, 4). You can indicate a rating scale by specifying best (default: 5) and worst (default: 1). <a rel="nofollow" target="_blank" href="http://www.google.com/support/webmasters/bin/answer.py?answer=172705">More information about review ratings.</a></td>
</tr>
<tr>
<td>reviewer</td>
<td>The author of the review.</td>
</tr>
<tr>
<td>dtreviewed</td>
<td>The date that the item was reviewed in <a rel="nofollow" target="_blank" href="http://www.w3.org/QA/Tips/iso-date">ISO date format</a>.</td>
</tr>
<tr>
<td>description</td>
<td>The body of the review.</td>
</tr>
<tr>
<td>summary</td>
<td>A short summary of the review.</td>
</tr>
</table>
<p>Could be marked up as:</p>
<div>
<div>
<pre><span><span>&lt;div</span> <span>class</span>=<span>"hreview"</span><span>&gt;</span></span> <span><span>&lt;span</span> <span>class</span>=<span>"item"</span><span>&gt;</span></span> <span><span>&lt;span</span> <span>class</span>=<span>"fn"</span><span>&gt;</span></span>L’Amourita Pizza<span><span>&lt;/span<span>&gt;</span></span></span> <span><span>&lt;/span<span>&gt;</span></span></span> Reviewed by <span><span>&lt;span</span> <span>class</span>=<span>"reviewer"</span><span>&gt;</span></span>Ulysses Grant<span><span>&lt;/span<span>&gt;</span></span></span> on <span><span>&lt;span</span> <span>class</span>=<span>"dtreviewed"</span><span>&gt;</span></span> Jan 6<span><span>&lt;span</span> <span>class</span>=<span>"value-title"</span> <span>title</span>=<span>"2009-01-06"</span> <span>/&gt;</span></span> <span><span>&lt;/span<span>&gt;</span></span></span>. <span><span>&lt;span</span> <span>class</span>=<span>"summary"</span><span>&gt;</span></span>Delicious, tasty pizza on Eastlake!<span><span>&lt;/span<span>&gt;</span></span></span> <span><span>&lt;span</span> <span>class</span>=<span>"description"</span><span>&gt;</span></span>L'Amourita serves up traditional wood-fired Neapolitan-style pizza, brought to your table promptly and without fuss. An ideal neighborhood pizza joint.<span><span>&lt;/span<span>&gt;</span></span></span> Rating: <span><span>&lt;span</span> <span>class</span>=<span>"rating"</span><span>&gt;</span></span>4.5<span><span>&lt;/span<span>&gt;</span></span></span>
<span><span>&lt;/div<span>&gt;</span></span></span></pre>
</div>
</div>
<p>Learn more about markup for reviews at <a rel="nofollow" target="_blank" href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&amp;answer=146645">webmaster central</a>.</p>
<p>Interested in getting started? Well there&#8217;s no reason not to start using microformats as much as possible already; semantic markup is always good for search engine optimization:</p>
<ol>
<li>Update your markup (<a rel="nofollow" target="_blank" href="http://validator.w3.org/">make sure it&#8217;s valid</a>) and use the <a rel="nofollow" target="_blank" href="http://quixapp.com/">Quix bookmarklet</a> to check your page, by entering &#8216;snippet&#8217; to submit the current page to Google Rich Snippets <a rel="nofollow" target="_blank" href="http://www.google.com/webmasters/tools/richsnippets">test tool</a>.</li>
<li>Getting the “Insufficient data to generate the preview” error? Then make sure that there are no errors in the markup (go back to step one) or check that you are using enough data to generate the snippet preview, so check the <a rel="nofollow" target="_blank" href="http://microformats.org/wiki/debugging-tools">microformat syntax again</a>.</li>
<li>Finally, <a rel="nofollow" target="_blank" href="http://www.google.com/support/webmasters/bin/request.py?contact_type=rich_snippets_feedback">let Google know</a> that you&#8217;re an early adopter.</li>
</ol>
<p>So who&#8217;s using microformats in this and other ways? Brands like <a rel="nofollow" target="_blank" href="http://www.google.com/webmasters/tools/richsnippets?url=http://mashable.com/">Mashable</a>, <a rel="nofollow" target="_blank" href="http://www.ysearchblog.com/2008/03/13/the-yahoo-search-open-ecosystem/">Yahoo!</a>, <a rel="nofollow" target="_blank" href="http://www.google.com/webmasters/tools/richsnippets?url=http://www.yelp.com/biz/christian-louboutin-new-york">Yelp</a>, Technorati, SearchMonkey, <a rel="nofollow" target="_blank" href="http://www.google.com/webmasters/tools/richsnippets?url=http://www.linkedin.com/in/w3edge">LinkedIn</a>, <a rel="nofollow" target="_blank" href="http://www.google.com/webmasters/tools/richsnippets?url=http://www.urbanspoon.com/r/6/765421/restaurant/Pizza-My-Heart-Santa-Cruz">Urbanspoon</a> and many more. If you&#8217;re interested in <a rel="nofollow" target="_blank" href="http://radar.oreilly.com/2009/05/google-adds-microformat-parsin.html">digging deeper</a> into the future of <a rel="nofollow" target="_blank" href="http://knol.google.com/k/google-rich-snippets-tips-and-tricks#Tips_and_tricks">microformats</a> as they relate to web analytics as well, Dennis Mortensen from Yahoo! has <a rel="nofollow" target="_blank" href="http://visualrevenue.com/blog/2009/12/using-microformats-to-extend-web-analytics-tagging.html">a great post</a> on what the future may hold.</p>
<p><a rel="nofollow" target="_blank" href="http://yoast.com/google-microformats-conversion-rate-optimization-serps/">Google &amp; Microformats: Drive More Traffic</a> is a post from <a rel="nofollow" target="_blank" href="http://yoast.com/about-me/">Joost de Valk</a>&#8216;s <a rel="nofollow" target="_blank" href="http://yoast.com">Yoast &#8211; Tweaking Websites</a>.A good WordPress blog needs good hosting, you don&#8217;t want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a rel="nofollow" target="_blank" href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/43d94_3ddYW3Ww0hU" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/joostdevalk">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/yoast-google-microformats-drive-more-traffic/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Sweet AJAX Tabs With jQuery 1.4 &amp; CSS3</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/tutorial/sweet-ajax-tabs-with-jquery-1-4-css3/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/tutorial/sweet-ajax-tabs-with-jquery-1-4-css3/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 04:30:07 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[tutorial]]></category>
		<category><![CDATA[background text]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[demo html]]></category>
		<category><![CDATA[div id]]></category>
		<category><![CDATA[li element]]></category>
		<category><![CDATA[new tabs]]></category>
		<category><![CDATA[span class]]></category>
		<category><![CDATA[tab two]]></category>
		<category><![CDATA[ul class]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/tutorial/sweet-ajax-tabs-with-jquery-1-4-css3/</guid>
		<description><![CDATA[Organizing the content of a page in a both intuitive and eye-catching manner, is a must in modern web design. One principle that has been around for some time is dividing text into tabs. This allows you to squeeze much more content in a seemingly limited space and provide a structured way of accessing it. [...]]]></description>
			<content:encoded><![CDATA[<p>Organizing the content of a page in a both intuitive and eye-catching manner, is a must in modern web design. One principle that has been around for some time is dividing text into tabs. This allows you to squeeze much more content in a seemingly limited space and provide a structured way of accessing it.</p>
<p>Today we are making an AJAX-powered tab page with CSS3 and the newly released version 1.4 of jQuery, so be sure to download the zip archive from the button above and continue with step one.</p>
<h3>Step 1 – XHTML</h3>
<p>As usual, we start off with the XHTML markup.</p>
<h4>demo.html</h4>
<pre>&lt;ul class="tabContainer"&gt;
	&lt;!-- The jQuery generated tabs go here --&gt;
&lt;/ul&gt;

&lt;div class="clear"&gt;&lt;/div&gt;

&lt;div id="tabContent"&gt;
	&lt;div id="contentHolder"&gt;
		&lt;!-- The AJAX fetched content goes here --&gt;
	&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>If you think the markup looks too simple to be true, you are right. As you can see, we are missing the code for the tabs, because it is inserted dynamically by jQuery on page load. This makes it extremely easy to add new tabs as you only need to add them on the JavaScript side (more on that in a moment).</p>
<h4>demo.html</h4>
<pre>&lt;li&gt;
	&lt;a href="#" class="tab green"&gt;Tab two
		&lt;span class="left"&gt;&lt;/span&gt;
		&lt;span class="right"&gt;&lt;/span&gt;
	&lt;/a&gt;
&lt;/li&gt;
</pre>
<p>This is the markup that is inserted by jQuery for each tab. It consists of a LI element positioned inside of the .<strong>tabContainer</strong> unordered list above, and contains a hyperlink with two spans. Those show the left and the right part of the background image and thus enable the tabs to stretch and give room for the text label inside.</p>
<p>Also notice the <strong>green</strong> class of the link &#8211; it determines the background, text color and hover state of the tab, as you will see in the next step of this tutorial.</p>
<div><a href="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/fb704_i12.png"><img class="size-full wp-image-636" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/fb704_i12.png" alt="Sweet AJAX-ed Tabs With jQuery 1.4 &amp; CSS3" width="620" height="460" /></a>
<p>Sweet AJAX-ed Tabs With jQuery 1.4 &amp; CSS3</p>
</div>
<h3>Step 2 – CSS</h3>
<p>With the markup in place, we can take a more detailed look at the styling of the tab page.</p>
<h4>styles.css &#8211; Part 1</h4>
<pre>.tabContainer{
	/* The UL */
	float:right;
	padding-right:13px;
}

#contentHolder{
	background-color:#EEEEEE;
	border:2px solid #FFFFFF;
	height:300px;
	margin:20px;

	color:#444444;
	padding:15px;
}

#tabContent{
	background-color:#333;
	border:1px solid #444;
	margin-top:-15px;
	width:100%;
}

#tabContent, .tabContainer li a,#contentHolder{
	-webkit-box-shadow:0 0 2px black;
	-moz-box-shadow:0 0 2px black;
	box-shadow:0 0 2px black;
}

.tabContainer li{
	/* This will arrange the LI-s next to each other */
	display:inline;
}

.tabContainer li a,.tabContainer li a:visited{
	/* Styling the hyperlinks of the tabs as colorful buttons */

	float:left;
	font-size:18px;

	/* display:block allows for additinal CSS rules to take effect, such as paddings: */
	display:block;

	padding:7px 16px 1px;
	margin:4px 5px;
	height:29px;

	/* Giving positioning */
	position:relative;

	/* CSS3 text-shadow */
	text-shadow:1px 1px 1px #CCCCCC;
}
</pre>
<p>Here we use a number of CSS3 rules that add up to the overall feel of the page. First is the <strong>box-shadow</strong> property, which adds a shadow below the tabs, the <strong>#tabContent</strong> div and the <strong>#contentHolder</strong>.</p>
<p>After this we have the <strong>text-shadow</strong> property, which adds a light-colored shadow (more of a outer glow in this case), which adds an inset feel to the text of the tabs.</p>
<h4>styles.css &#8211; Part 2</h4>
<pre>#overLine{
	/* The line above the active button. */
	position:absolute;

	height:1px;
	background-color:white;
	width:90px;

	float:left;
	left:1px;
	top:-5px;
	overflow:hidden;
}

#main{
	margin:0 auto;
	position:relative;
	width:700px;
}

ul .left{
	/* The left span in the hyperlink */

	height:37px;
	left:0;
	position:absolute;
	top:0;
	width:10px;
}

ul .right{
	/* The right span in the hyperlink */

	height:37px;
	right:0;
	position:absolute;
	top:0;
	width:10px;
}

/* Styling the colors individually: */

ul a.green{	background:url(img/green_mid.png) repeat-x top center;	color:#24570f;}
ul a.green span.left{ background:url(img/green_left.png) no-repeat left top;}
ul a.green span.right{ background:url(img/green_right.png) no-repeat right top;}

/* .. Analogical styles for the red, blue and orange color .. */

/* The hover states: */
ul a:hover{	background-position:bottom center; text-decoration:none;}
ul a:hover span.left{ background-position:left bottom;}
ul a:hover span.right{ background-position:right bottom;}

.preloader{
	display:block;
	margin:120px auto;
}
</pre>
<p>In the second part of the code, you can see that we define different backgrounds for the hyperlink and the left and right spans, depending on the color class that is assigned. This way we can successfully change a number of CSS styles and as a result have a completely different design of the tab, by just setting a different class name for the hyperlink.</p>
<div><a href="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/fb704_i32.png"><img class="size-full wp-image-637" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/fb704_i32.png" alt="The Tabs" width="620" height="260" /></a>
<p>The Tabs</p>
</div>
<h3>Step 3 – jQuery</h3>
<p>This is where the magic happens. First we need to include the jQuery library in the page:</p>
<h4>demo.html</h4>
<pre>&lt;link rel="stylesheet" type="text/css" href="styles.css" /&gt;

&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="script.js"&gt;&lt;/script&gt;
</pre>
<p>We include the latest version of jQuery from Google&#8217;s CDN and immediately after it, we add our own <strong>script.js</strong> file, which contains all of our scripts.</p>
<p>Here is a detailed explanation of what exactly jQuery does:</p>
<ul>
<li>The page is opened in a      visitor’s browser and the jQuery  library is downloaded from Google’s      Content Depository Network;</li>
<li><strong>$(document).ready()</strong> is queued for execution and the function  that is provided as a      parameter is run when the DOM has  finished loading;</li>
<li>The Tabs object is looped with      the <strong>$.each()</strong> method      and individual <strong>&lt;LI&gt;</strong> elements are created and appended  to the      <strong>.tabContainer</strong> <strong>&lt;UL&gt;</strong> (covered in step one);</li>
<li>Event listeners for the <strong>click</strong> event on the tabs are set up.</li>
</ul>
<p>You can view the code below:</p>
<h4>script.js &#8211; Part 1</h4>
<pre>$(document).ready(function(){
	/* This code is executed after the DOM has been completely loaded */

	/* Defining an array with the tab text and AJAX pages: */

	var Tabs = {
		'Tab one'	: 'pages/page1.html',
		'Tab two'	: 'pages/page2.html',
		'Tab three'	: 'pages/page3.html',
		'Tab four'	: 'pages/page4.html'
	}

	/* The available colors for the tabs: */
	var colors = ['blue','green','red','orange'];

 	/* The colors of the line above the tab when it is active: */
	var topLineColor = {
		blue:'lightblue',
		green:'lightgreen',
		red:'red',
		orange:'orange'
	}

	/* Looping through the Tabs object: */
	var z=0;
	$.each(Tabs,function(i,j){
		/* Sequentially creating the tabs and assigning a color from the array: */

		var tmp = $('&lt;li&gt;&lt;a href="#" class="tab '+colors[(z++%4)]+'"&gt;'+i+' &lt;span class="left" /&gt;&lt;span class="right" /&gt;&lt;/a&gt;&lt;/li&gt;');

		/* Setting the page data for each hyperlink: */

		tmp.find('a').data('page',j);

		/* Adding the tab to the UL container: */
		$('ul.tabContainer').append(tmp);
	})
</pre>
<p>The source above is the first part of <strong>script.js</strong>, which you can find in the download archive. You can add your own tabs on the page by inserting a new property to the Tabs object. The left part holds the name of the tab in single quotes, and the right part (after the semicolon) contains the AJAX URL which is going to be fetched and displayed in the <strong>#contentHolder</strong> div.</p>
<p>In the following second part of the script, you&#8217;ll see jQuery 1.4 in action, as we create a new div element (that acts as the line above the active tab) and pass an object with the ID and CSS properties instead of setting them separately with the <strong>.attr()</strong> and <strong>.css()</strong> methods.</p>
<h4>script.js &#8211; Part 2</h4>
<pre>	/* Caching the tabs into a variable for better performance: */
	var the_tabs = $('.tab');

	the_tabs.click(function(e){

		/* "this" points to the clicked tab hyperlink: */
		var element = $(this);

 		/* If it is currently active, return false and exit: */
		if(element.find('#overLine').length) return false;

 		/* Detecting the color of the tab (it was added to the class attribute in the loop above): */

		var bg = element.attr('class').replace('tab ','');

 		/* Removing the line: */
		$('#overLine').remove();

 		/* Creating a new div element with jQuery 1.4 by passing an additional object parameter: */

		$('&lt;div&gt;',{
			id:'overLine',
			css:{
				display:'none',
				width:element.outerWidth()-2,
				background:topLineColor[bg] || 'white'
			}}).appendTo(element).fadeIn('slow');

 		/* Checking whether the AJAX fetched page has been cached: */

		if(!element.data('cache'))
		{
			/* If no cache is present, show the gif preloader and run an AJAX request: */
			$('#contentHolder').html('&lt;img src="img/ajax_preloader.gif" width="64" height="64" class="preloader" /&gt;');

 			$.get(element.data('page'),function(msg){
				$('#contentHolder').html(msg);

 				/* After page was received, add it to the cache for the current hyperlink: */
				element.data('cache',msg);
			});
		}
		else $('#contentHolder').html(element.data('cache'));

 		e.preventDefault();
	})

	/* Emulating a click on the first tab, so that the content area is not empty: */
	the_tabs.eq(0).click();

});
</pre>
<p>Notice the use of the jQuery <strong>data()</strong> method throughout the code. It assigns arbitrary data to an element by calling the method with two parameters <strong>$(‘#selector’).data(‘label’,”String Data”)</strong>. This assigns the string “String Data” to the element and we can later access it (or check if it has been set) by calling the data method without the second parameter.</p>
<p>This way we set up a simple caching system for the AJAX requests. The first time an AJAX call is made, the text of the response (held in the <strong>msg</strong> variable) is stored at <strong>data(‘cache’)</strong>. On consecutive calls we check for this cache variable and return it instead of firing a new request. This way we remove unnecessary server load and improve the responsiveness of the tabs.</p>
<div><a href="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/ce3ee_i23.png"><img class="size-full wp-image-638" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/ce3ee_i23.png" alt="Active Tab" width="620" height="260" /></a>
<p>Active Tab</p>
</div>
<p>With this our sweet AJAX-ed tabs are complete!</p>
<h3>Conclusion</h3>
<p>Today we created AJAX &#8211; enabled colorful tabs with jQuery 1.4 and CSS3. We also implemented a simple caching mechanism using the data() method. The source code is easily modifiable and adding new tabs is as easy as adding new properties to the Tabs object.</p>
<p>If you liked this tutorial, be sure to <a href="http://twitter.com/Tutorialzine" target="_blank">follow us on twitter</a> for early previews and interesting links from the world of web development.</p>
<p><strong>What do you think? How would you improve this example?</strong></p>
<div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/968ef_hySb3NOq944" height="1" width="1" /></p>
<p><a href="http://feeds.feedburner.com/Tutorialzine">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/tutorial/sweet-ajax-tabs-with-jquery-1-4-css3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>AJAX-enabled Sticky Notes With PHP &amp; jQuery</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/tutorial/ajax-enabled-sticky-notes-with-php-jquery/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/tutorial/ajax-enabled-sticky-notes-with-php-jquery/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 06:28:17 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[tutorial]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[div id]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[green button]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[note]]></category>
		<category><![CDATA[note management]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[span class]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[textarea name]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/tutorial/ajax-enabled-sticky-notes-with-php-jquery/</guid>
		<description><![CDATA[Today we are making an AJAX-enabled Sticky Note management system. It will give visitors the ability to create notes with a live preview, and move them around on the screen. Every movement is going to be sent to the back-end via AJAX and saved in the database. We are using version 1.4 of jQuery and [...]]]></description>
			<content:encoded><![CDATA[<p>Today we are making an AJAX-enabled Sticky Note management system. It will give visitors the ability to create notes with a live preview, and move them around on the screen. Every movement is going to be sent to the back-end via AJAX and saved in the database.</p>
<p>We are using version <strong>1.4</strong> of jQuery and the <a href="http://fancybox.net/" target="_blank">fancybox plugin</a> (you can also check our <a href="http://tutorialzine.com/2009/11/hovering-gallery-css3-jquery/" target="_blank">CSS3 Lightbox Gallery Tutorial</a>, where we also used fancybox).</p>
<p>You can download the example files and keep the demo site open in a tab so that it is easier to follow the steps of the tutorial.</p>
<h3>Step 1 &#8211; XHTML</h3>
<p>The first step is to create the necessary XHTML structure. The markup in the main demonstration file &#8211; <strong>demo.php</strong> is pretty straightforward, as you can see for yourself from the code below.</p>
<h4>demo.php</h4>
<pre>&lt;div id="main"&gt;
&lt;a id="addButton" class="green-button" href="add_note.html"&gt;Add a note&lt;/a&gt;

&lt;?php echo $notes?&gt;

&lt;/div&gt;</pre>
<p>It contains the <strong>main</strong> div, which holds all the notes and  limits their movement during the dragging process. The rest is generated dynamically by PHP after running a SELECT query against the database, and after storing the result in the <strong>$notes</strong> variable as you will see in the next step.</p>
<p>If you click the &#8220;Add a note&#8221; button on the demonstration site, you will see that a form with a live preview pops up. This functionality is provided by the fancybox, which fetches <strong>add_note.html</strong> (which contains the form) and shows it within a pop-up.</p>
<h4>add_note.html</h4>
<pre>&lt;h3 class="popupTitle"&gt;Add a new note&lt;/h3&gt;

&lt;!-- The preview: --&gt;
&lt;div id="previewNote" class="note yellow" style="left:0;top:65px;z-index:1"&gt;
&lt;div class="body"&gt;&lt;/div&gt;
&lt;div class="author"&gt;&lt;/div&gt;
&lt;span class="data"&gt;&lt;/span&gt;
&lt;/div&gt;

&lt;div id="noteData"&gt; &lt;!-- Holds the form --&gt;
&lt;form action="" method="post" class="note-form"&gt;

&lt;label for="note-body"&gt;Text of the note&lt;/label&gt;
&lt;textarea name="note-body" id="note-body" class="pr-body" cols="30" rows="6"&gt;&lt;/textarea&gt;

&lt;label for="note-name"&gt;Your name&lt;/label&gt;
&lt;input type="text" name="note-name" id="note-name" class="pr-author" value="" /&gt;

&lt;label&gt;Color&lt;/label&gt; &lt;!-- Clicking one of the divs changes the color of the preview --&gt;
&lt;div class="color yellow"&gt;&lt;/div&gt;
&lt;div class="color blue"&gt;&lt;/div&gt;
&lt;div class="color green"&gt;&lt;/div&gt;

&lt;!-- The green submit button: --&gt;
&lt;a id="note-submit" href="" class="green-button"&gt;Submit&lt;/a&gt;

&lt;/form&gt;
&lt;/div&gt;</pre>
<p>In the form you can fill in the text of the note, your name and choose a color. Providing a way for users to see how their note will appear in the page in real time is a useful addition which serves another practical purpose &#8211; when clicking the submit button and the lightbox window closes, the preview note is copied to the <strong>main</strong> div, which saves us from writing additional code.</p>
<div><a href="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/f4fa2_i11.png"><img class="size-full wp-image-628" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/f4fa2_i11.png" alt="Note Creation Form With Live Preview" width="620" height="460" /></a>
<p>Note Creation Form With Live Preview</p>
</div>
<h3>Step 2 &#8211; PHP</h3>
<p>As mentioned earlier, PHP fills the <strong>$notes</strong> variable by running a query againts the database and outputs it on the page. Lets see how this works.</p>
<h4>demo.php</h4>
<pre>$query = mysql_query("SELECT * FROM notes ORDER BY id DESC");

$notes = '';
$left='';
$top='';
$zindex='';
while($row=mysql_fetch_assoc($query))
{
	// The xyz column holds the position and z-index in the form 200x100x10:
	list($left,$top,$zindex) = explode('x',$row['xyz']);
	$notes.= '
		&lt;div class="note '.$row['color'].'" style="left:'.$left.'px;top:'.$top.'px;	z-index:'.$zindex.'"&gt;
		'.htmlspecialchars($row['text']).'
		&lt;div class="author"&gt;'.htmlspecialchars($row['name']).'&lt;/div&gt;
		&lt;span class="data"&gt;'.$row['id'].'&lt;/span&gt;
	&lt;/div&gt;';
}</pre>
<p>The notes table not only stores the text and the author of the note, but it also has a dedicated column for the <strong>x</strong> and <strong>y</strong> coordinates, as well for the <strong>z-index</strong> (or stacking order). Those are stored in the <strong>xyz</strong> field of the table, which is updated by AJAX.</p>
<p>After the visitor clicks on the &#8220;<strong>Add a note</strong>&#8221; button, <strong>fancybox</strong> grabs <strong>add_note.html</strong> (which was covered in step one) and displays the live preview form. When it is submitted, the data is sent via AJAX to <strong>post.php</strong>, given below.</p>
<h4>post.php</h4>
<pre>// Escaping the input data:
$author = mysql_real_escape_string(strip_tags($_POST['author']));
$body = mysql_real_escape_string(strip_tags($_POST['body']));
$color = mysql_real_escape_string($_POST['color']);
$zindex = (int)$_POST['zindex'];

/* Inserting a new record in the notes DB: */
mysql_query('	INSERT INTO notes (text,name,color,xyz)
VALUES ("'.$body.'","'.$author.'","'.$color.'","0x0x'.$zindex.'")');

if(mysql_affected_rows($link)==1)
{
	// Return the id of the inserted row:
	echo mysql_insert_id($link);
}
else echo '0';</pre>
<p>After escaping all the input data and inserting it in the table, the script checks whether there were any rows affected after the insert query. If <strong>mysql_affected_rows</strong> returns 1, this would mean that the insert was successful and the automatically assigned <strong>auto_increment</strong> ID is outputted.</p>
<p>AJAX is also used to save the positions of the individual notes after the end of each movement. The JavaScript code that actually requests these AJAX calls is presented in step 4 of this tutorial. The PHP code is included below:</p>
<h4>update_position.php</h4>
<pre>// Validating the input data:
if(!is_numeric($_GET['id']) || !is_numeric($_GET['x']) || !is_numeric($_GET['y']) || !is_numeric($_GET['z']))
die("0");

// Escaping:
$id = (int)$_GET['id'];
$x = (int)$_GET['x'];
$y = (int)$_GET['y'];
$z = (int)$_GET['z'];

// Saving the position and z-index of the note:
mysql_query("UPDATE notes SET xyz='".$x."x".$y."x".$z."' WHERE id=".$id);

echo "1";</pre>
<p>After making sure that the input data is valid, the script updates the xyz field of the row for the note in question and prints 1 on success.</p>
<p>Lets continue with step three.</p>
<h3>Step 3 &#8211; CSS</h3>
<p>All the markup is in place, so it is time to throw in some fancy styling. The styles are defined in styles.css. I divided the file in three parts.</p>
<h4>styles.css &#8211; Part 1</h4>
<pre>.note{
	height:150px;
	padding:10px;
	width:150px;
	position:absolute;
	overflow:hidden;
	cursor:move;

	font-family:Trebuchet MS,Tahoma,Myriad Pro,Arial,Verdana,sans-serif;
	font-size:22px;

	/* Adding a CSS3 shadow below the note, in the browsers which support it: */
	-moz-box-shadow:2px 2px 0 #DDDDDD;
	-webkit-box-shadow:2px 2px 0 #DDDDDD;
	box-shadow:2px 2px 0 #DDDDDD;
}

#fancy_ajax .note{ cursor:default; }

/* Three styles for the notes: */

.yellow{
	background-color:#FDFB8C;
	border:1px solid #DEDC65;
}

.blue{
	background-color:#A6E3FC;
	border:1px solid #75C5E7;
}

.green{
	background-color:#A5F88B;
	border:1px solid #98E775;
}

/* Each note has a data span, which holds its ID */
span.data{ display:none; }

/* The "Add a note" button: */
#addButton{
	position:absolute;
	top:-70px;
	left:0;
}</pre>
<p>In the first part we define the appearance of the notes and provide three color schemes &#8211; yellow, blue and green. Those color classes are also used in the live preview form when creating a note.</p>
<p>Every note has special span element with a class name of <strong>data</strong>, which holds the internal ID it is assigned in the database. This ID is used by jQuery and returned with the AJAX calls back to the server in order to update the note&#8217;s position and z-index.  We are hiding this span from view with <strong>display:none</strong>.</p>
<div><a href="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/f4fa2_i22.png"><img class="size-full wp-image-627" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/f4fa2_i22.png" alt="Three Styles Of Notes" width="620" height="260" /></a>
<p>Three Styles Of Notes</p>
</div>
<h4>styles.css &#8211; Part 2</h4>
<pre>/* Green button class: */
a.green-button,a.green-button:visited{
	color:black;
	display:block;
	font-size:10px;
	font-weight:bold;
	height:15px;
	padding:6px 5px 4px;
	text-align:center;
	width:60px;

	text-shadow:1px 1px 1px #DDDDDD;
	background:url(img/button_green.png) no-repeat left top;
}

a.green-button:hover{
	text-decoration:none;
	background-position:left bottom;
}

.author{
	/* The author name on the note: */
	bottom:10px;
	color:#666666;
	font-family:Arial,Verdana,sans-serif;
	font-size:12px;
	position:absolute;
	right:10px;
}

#main{
	/* Contains all the notes and limits their movement: */
	margin:0 auto;
	position:relative;
	width:980px;
	height:500px;
	z-index:10;
	background:url(img/add_a_note_help.gif) no-repeat left top;
}</pre>
<p>The second part of the file defines the green button class, complete with a hover state and a CSS3 text-shadow. These are a few tiny details that may not look like much, but leave a good overall impression to the user.</p>
<h4>styles.css &#8211; Part 3</h4>
<pre>h3.popupTitle{
	border-bottom:1px solid #DDDDDD;
	color:#666666;
	font-size:24px;
	font-weight:normal;
	padding:0 0 5px;
}

#noteData{
	/* The input form in the pop-up: */
	height:200px;
	margin:30px 0 0 200px;
	width:350px;
}

.note-form label{
	display:block;
	font-size:10px;
	font-weight:bold;
	letter-spacing:1px;
	text-transform:uppercase;
	padding-bottom:3px;
}

.note-form textarea, .note-form input[type=text]{
	background-color:#FCFCFC;
	border:1px solid #AAAAAA;
	font-family:Arial,Verdana,sans-serif;
	font-size:16px;
	height:60px;
	padding:5px;
	width:300px;
	margin-bottom:10px;
}

.note-form input[type=text]{	height:auto; }

.color{
	/* The color swatches in the form: */
	cursor:pointer;
	float:left;
	height:10px;
	margin:0 5px 0 0;
	width:10px;
}

#note-submit{	margin:20px auto; }</pre>
<p>In the last part of styles.css, we add CSS rules for the live preview form, staring from the H3 heading and finishing with the color swatches on the bottom.</p>
<h3>Step 4 &#8211; jQuery</h3>
<p>jQuery manages the front-end and all of the AJAX requests. In order to be able to use the library, we first need to include a few lines to the head section of demo.php:</p>
<h4>demo.php</h4>
<pre>&lt;link rel="stylesheet" type="text/css" href="styles.css" /&gt;
&lt;link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox-1.2.6.css" media="screen" /&gt;

&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="fancybox/jquery.fancybox-1.2.6.pack.js"&gt;&lt;/script&gt;

&lt;script type="text/javascript" src="script.js"&gt;&lt;/script&gt;</pre>
<p>We include jQuery and jQuery UI from Google&#8217;s content repository network, as well as the rest of the css and js files needed for this tutorial. Now lets dig a bit deeper into our jQuery script.</p>
<h4>script.js &#8211; Part 1</h4>
<pre>$(document).ready(function(){
	/* This code is executed after the DOM has been completely loaded */

	var tmp;

	$('.note').each(function(){
		/* Finding the biggest z-index value of the notes */

		tmp = $(this).css('z-index');
		if(tmp&gt;zIndex) zIndex = tmp;
	})

	/* A helper function for converting a set of elements to draggables: */
	make_draggable($('.note'));

	/* Configuring the fancybox plugin for the "Add a note" button: */
	$("#addButton").fancybox({
		'zoomSpeedIn'		: 600,
		'zoomSpeedOut'		: 500,
		'easingIn'			: 'easeOutBack',
		'easingOut'			: 'easeInBack',
		'hideOnContentClick': false,
		'padding'			: 15
	});

	/* Listening for keyup events on fields of the "Add a note" form: */
	$('.pr-body,.pr-author').live('keyup',function(e){

		if(!this.preview)
			this.preview=$('#previewNote');

		/* Setting the text of the preview to the contents of the input field, and stripping all the HTML tags: */
		this.preview.find($(this).attr('class').replace('pr-','.')).html($(this).val().replace(/&lt;[^&gt;]+&gt;/ig,''));
	});

	/* Changing the color of the preview note: */
	$('.color').live('click',function(){

		$('#previewNote').removeClass('yellow green blue').addClass($(this).attr('class').replace('color',''));
	});</pre>
<p>First the script finds the maximum <strong>z-index</strong> value, so that it can cache it into the <strong>zIndex</strong> variable and increment it before assigning it to the notes in the beginning of every drag movement. This way, when you start dragging a note, it is moved to the top of the stack.</p>
<p>Another interesting moment is that we use the jQuery <strong>live()</strong> method to listen for events, instead of the regular <strong>bind()</strong>. This is so, because the page elements we are listening for events on, are created only when the form is shown and, once defined, <strong>live()</strong> event listeners are active on all elements yet to be created.</p>
<h4>script.js &#8211; Part 2</h4>
<pre>	/* The submit button: */
	$('#note-submit').live('click',function(e){

		if($('.pr-body').val().length&lt;4)
		{
			alert("The note text is too short!")
			return false;
		}

		if($('.pr-author').val().length&lt;1)
		{
			alert("You haven't entered your name!")
			return false;
		}

		$(this).replaceWith('&lt;img src="img/ajax_load.gif" style="margin:30px auto;display:block" /&gt;');

		var data = {
			'zindex'	: ++zIndex,
			'body'		: $('.pr-body').val(),
			'author'		: $('.pr-author').val(),
			'color'		: $.trim($('#previewNote').attr('class').replace('note',''))
		};

		/* Sending an AJAX POST request: */
		$.post('ajax/post.php',data,function(msg){

			if(parseInt(msg))
			{
				/* msg contains the ID of the note, assigned by MySQL's auto increment: */
				var tmp = $('#previewNote').clone();

				tmp.find('span.data').text(msg).end().css({'z-index':zIndex,top:0,left:0});
				tmp.appendTo($('#main'));

				make_draggable(tmp)
			}

			$("#addButton").fancybox.close();
		});

		e.preventDefault();
	})
});</pre>
<p>Here we are listening for the click event on the form submit link. Once clicked, the data is validated and sent with the <strong>$.post</strong> method. If the insert was successful, the lightbox is hidden and the newly created note is added to the page. Notice that we are using the <strong>make_draggable </strong>function, which is included below.</p>
<div><a href="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/c3f58_i31.png"><img class="size-full wp-image-629" src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/c3f58_i31.png" alt="The Note Position And Stacking Are Saved With AJAX" width="620" height="260" /></a>
<p>The Note Position And Stacking Are Saved With AJAX</p>
</div>
<h4>script.js &#8211; Part 3</h4>
<pre>var zIndex = 0;

function make_draggable(elements)
{
	/* Elements is a jquery object: */
	elements.draggable({
		containment:'parent',
		start:function(e,ui){ ui.helper.css('z-index',++zIndex); },
		stop:function(e,ui){

			/* Sending the z-index and positon of the note to update_position.php via AJAX GET: */
			$.get('ajax/update_position.php',{
				x		: ui.position.left,
				y		: ui.position.top,
				z		: zIndex,
				id	: parseInt(ui.helper.find('span.data').html())
			});
		}
	});
}</pre>
<p>In the last part of script.js, we have the <strong>make_draggable</strong> function. It turns a set of jQuery elements passed as a parameter into draggable objects. I&#8217;ve moved this functionality into a separate function  because we need to create draggables in twice &#8211; once on initial page load, and once when we add a new note to the page.</p>
<h3>Step 5 &#8211; MySQL</h3>
<p>If you plan on running and building upon this demo, you&#8217;ll need to set up a working version on your server. You&#8217;ll need to execute the code from <strong>table.sql</strong> of the download archive in phpMyAdmin and fill in your database credentials in <strong>connect.php</strong>.</p>
<p>With this our AJAX-ed Sticky Note system is complete!</p>
<h3>Conclusion</h3>
<p>Today we created an Ajax Enabled Sticky Note Management System and demonstrated how we could use one of the readily available plug-ins for the jQuery library to build a dynamic interface, complete with a live preview.</p>
<p><strong>What do you think? How would you improve this code?</strong></p>
<div>
<a href="http://feeds.feedburner.com/~ff/Tutorialzine?a=myPLnq4pDRA:YkJtg0vR6q0:yIl2AUoC8zA"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/c3f58_Tutorialzine?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Tutorialzine?a=myPLnq4pDRA:YkJtg0vR6q0:D7DqB2pKExk"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/c3f58_Tutorialzine?i=myPLnq4pDRA:YkJtg0vR6q0:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Tutorialzine?a=myPLnq4pDRA:YkJtg0vR6q0:F7zBnMyn0Lo"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/d0bb3_Tutorialzine?i=myPLnq4pDRA:YkJtg0vR6q0:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Tutorialzine?a=myPLnq4pDRA:YkJtg0vR6q0:V_sGLiPBpWU"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/aac37_Tutorialzine?i=myPLnq4pDRA:YkJtg0vR6q0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Tutorialzine?a=myPLnq4pDRA:YkJtg0vR6q0:gIN9vFwOqvQ"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/aac37_Tutorialzine?i=myPLnq4pDRA:YkJtg0vR6q0:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Tutorialzine?a=myPLnq4pDRA:YkJtg0vR6q0:qj6IDK7rITs"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/aac37_Tutorialzine?d=qj6IDK7rITs" border="0"></img></a>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/aac37_myPLnq4pDRA" height="1" width="1" /></p>
<p><a href="http://feeds.feedburner.com/Tutorialzine">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/tutorial/ajax-enabled-sticky-notes-with-php-jquery/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using jQuery to Style Design Elements: 20 Impressive Plugins</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/using-jquery-to-style-design-elements-20-impressive-plugins/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/using-jquery-to-style-design-elements-20-impressive-plugins/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 13:21:27 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[web resources]]></category>
		<category><![CDATA[anchor links]]></category>
		<category><![CDATA[Chris Coyier]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[design elements]]></category>
		<category><![CDATA[div style]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[quot]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[span]]></category>
		<category><![CDATA[span class]]></category>
		<category><![CDATA[styling design]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/using-jquery-to-style-design-elements-20-impressive-plugins/</guid>
		<description><![CDATA[I know we covered different jQuery posts here but you guys don&#8217;t stop asking for more. So here we are again covering more jQuery Plugins doing what: Styling Design Elements. So today we need jQuery solutions that are a little more specific. Here are 20 more handy jQuery plugins that have made websites much sleeker [...]]]></description>
			<content:encoded><![CDATA[<p>I know we covered <a href="http://devsnippets.com/reviews/15-jquery-plugins-to-fix-and-beautify-browser-issues.html">different</a> <a href="http://devsnippets.com/jquery-posts/20-jquery-plugins-for-unforgettable-user-experience.html">jQuery </a>posts here but you guys don&#8217;t stop asking for more. So here we are again covering more jQuery Plugins doing what: Styling Design Elements. So today we need jQuery solutions that are a little more specific. Here are 20 more handy jQuery plugins that have made websites much sleeker and more interesting.</p>
<h3>1. <a href="http://www.webdesignerwall.com/tutorials/jquery-sequential-list/">jQuery Sequential List</a></h3>
<p><a href="http://www.webdesignerwall.com/tutorials/jquery-sequential-list/"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/9bc17_jquery-designelements1.jpg" alt="" /></a></p>
<p>This tutorial will show you how to use jQuery to add a sequent of CSS classes to create a graphical list. The second example in this tutorial will show you how to add a comment counter to a comment list using jQuery’s prepend feature. The code is very simple, the following example shows how you can add a counter number to a comment list. </p>
<pre>
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function(){

  $(&quot;#commentlist li&quot;).each(function (i) {
    i = i 1;
    $(this).prepend(&#39;&lt;span class=&quot;commentnumber&quot;&gt; #&#39; i &#39;&lt;/span&gt;&#39;);
   });

});
&lt;/script&gt;
</pre>
<p>To get this markup:</p>
<pre>
&lt;ol id=&quot;commentlist&quot;&gt;
	&lt;li&gt;&lt;span class=&quot;commentnumber&quot;&gt; #1&lt;/span&gt;
		...
	&lt;/li&gt;
	&lt;li&gt;&lt;span class=&quot;commentnumber&quot;&gt; #2&lt;/span&gt;
		...
	&lt;/li&gt;
	&lt;li&gt;&lt;span class=&quot;commentnumber&quot;&gt; #3&lt;/span&gt;
		...
	&lt;/li&gt;
&lt;/ol&gt;
</pre>
<p><a href="http://webdesignerwall.com/demo/jquery-sequential/jquery-sequential-list.html">Check out the demo here</a></p>
<h3>2. <a href="http://www.atblabs.com/jquery.corners.html">jQuery Corners</a></h3>
<p><a href="http://www.atblabs.com/jquery.corners.html"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/94ffa_jquery-designelements2.jpg" alt="" /></a></p>
<p>This jQuery plugin will simple allow you to create rounded corner for your design elements including forms or anchor links without using images or obstructive markup.</p>
<p>Once jQuery and jQuery.corners scripts are loaded, rounding corners is easy. </p>
<pre>
&lt;div style=&quot;background-color:#acc; padding:5px&quot; class=&quot;rounded&quot;&gt;
  Simple Example
&lt;/div&gt;
&lt;script&gt;$(document).ready( function(){
  $(&#39;.rounded&#39;).corners();
});&lt;/script&gt;
</pre>
<p><a href="http://www.atblabs.com/jquery.corners.html">Check out the demo here</a></p>
<h3>3. <a href="http://widowmaker.kiev.ua/checkbox/">jQuery Checkbox</a></h3>
<p><a href="http://widowmaker.kiev.ua/checkbox/"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/01b44_jquery-designelements3.jpg" alt="" /></a></p>
<p>This jQuery plugin will simple skin checkboxes and radio buttons in a nice way.</p>
<p><a href="http://widowmaker.kiev.ua/checkbox/">Check out the demo here</a></p>
<h3>4. <a href="http://www.filamentgroup.com/lab/styling_buttons_and_toolbars_with_the_jquery_ui_css_framework/">Styling Buttons and Toolbars with the jQuery UI CSS Framework</a></h3>
<p><a href="http://www.filamentgroup.com/lab/styling_buttons_and_toolbars_with_the_jquery_ui_css_framework/"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/a95cf_jquery-designelements4.jpg" alt="" /></a></p>
<p>This tutorial demonstrates how to incorporate the power of jQuery UI CSS framework classes in a custom widget to create and style buttons and toolbars.</p>
<p>Creating a basic button is very simple with the jQuery UI CSS framework and styling it is really easy. All you need to do is add the default &#8220;clickable&#8221; state by assigning the class ui-state-default. We also want these to have rounded corners, so we added the optional ui-corner-all framework class which adds CSS3 corner-radius properties to all corners without the need for any images or extra markup.</p>
<pre>
&lt;button class=&quot;ui-state-default ui-corner-all&quot; type=&quot;submit&quot;&gt;Button&lt;/button&gt;
&lt;a href=&quot;#&quot; class=&quot;ui-state-default ui-corner-all&quot;&gt;Link&lt;/a&gt;
</pre>
<p><a href="http://www.filamentgroup.com/examples/buttonFrameworkCSS/">Check out the demo here</a></p>
<h3>5. <a href="http://www.smashingmagazine.com/2009/01/22/ask-sm-how-to-create-a-colorful-sitemap-with-jquery/">Create A Colorful Sitemap With jQuery</a></h3>
<p><a href="http://www.smashingmagazine.com/2009/01/22/ask-sm-how-to-create-a-colorful-sitemap-with-jquery/"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/d5b61_jquery-designelements5.jpg" alt="" /></a></p>
<p>In this article, Chris Coyier teaches us how to build a visually interesting sitemap that makes the hierarchy clearer through the use of color. The idea here is, when the mouse cursor hovers over a list, that list will brighten up a bit and fade to a unique color. When the mouse cursor is removed, the list will return to its original color.</p>
<p><a href="http://css-tricks.com/examples/Sitemap">Check out the demo here</a></p>
<h3>6. <a href="http://blog.jeremymartin.name/2008/02/blogger-trick-style-author-comments.html"> Style Author Comments Differently with jQuery</a></h3>
<p><a href="http://blog.jeremymartin.name/2008/02/blogger-trick-style-author-comments.html"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/ba7d3_jquery-designelements6.jpg" alt="" /></a></p>
<p>Now you want to apply the custom styling applied to comments left by the author on blogger. The script will loop through all of the comments on the page, if the member link on the current comment matches the member link in the profile page on your blog, then it must be an author comment. The script will then apply an additional class to the comment, allowing you to style it separately.</p>
<p><a href="http://blog.jeremymartin.name/2008/02/blogger-trick-style-author-comments.html">Check out the demo here</a></p>
<h3>7. <a href="http://code.google.com/p/jquery-asmselect/">asmSelect &#8211; Alternative Select Multiple</a></h3>
<p><a href="http://code.google.com/p/jquery-asmselect/"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/8c6b7_jquery-designelements7.jpg" alt="" /></a></p>
<p>A progressive enhancement to &lt;select multiple&gt; form elements which is easier for users to understand and interact with than regular &lt;select multiple&gt; form elements. Also, it doesn&#8217;t require user to Ctrl-Click or Shift-Click multiple elements. Instead users of your form can add or remove elements individually, without risk of losing those that have already been selected. </p>
<p><a href="http://www.ryancramer.com/projects/asmselect/examples/example1.html">Check out the demo here</a></p>
<h3>8. <a href="http://plugins.jquery.com/project/flexigrid">Flexgrid </a></h3>
<p><a href="http://plugins.jquery.com/project/flexigrid"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/8ad74_jquery-designelements8.jpg" alt="" /></a></p>
<p>A lightweight but rich data grid with resizable columns and a scrolling data to match the headers, plus an ability to connect to an xml based data source to load the content. Features include: Resizable columns, Resizable height, Sortable column headers, Cool theme, Can convert an ordinary table, Paging, Show/hide columns and more.</p>
<p><a href="http://sanderkorvemaker.nl/test/flexigrid/">Check out the demo here</a></p>
<h3>9. <a href="http://www.anon-design.se/demo/maxlength/">MaxLength</a></h3>
<p><a href="http://www.anon-design.se/demo/maxlength/"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/c2de7_jquery-designelements9.jpg" alt="" /></a></p>
<p>This plugin makes it easy to apply a &quot;maxlength&quot; attribute to custom elements for example a &lt;textarea&gt;. It also gives you the possibility to add a nice character counter under the element that shows the user how many chars he/she has left before the maxlength is reached, and/or an alert message.</p>
<p>To use this on a simple text area, all you have to do is:</p>
<pre>
&lt;script type=&quot;text/javascript&quot;&gt;
  $(document).ready(function(){
    $(&#39;#textarea_1_1&#39;).maxlength();
  });
&lt;/script&gt;
</pre>
<p><a href="http://www.anon-design.se/demo/maxlength/">Check out the demo here</a></p>
<h3>10. <a href="http://www.oakcitygraphics.com/jquery/clockpick/trunk/ClockPick.cfm">ClockPick</a></h3>
<p><a href="http://www.oakcitygraphics.com/jquery/clockpick/trunk/ClockPick.cfm"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/a48b2_jquery-designelements10.jpg" alt="" /></a></p>
<p>ClockPick is a timepicker plugin, enabling users to enter a time value into a form field. Using a unique popup div UI, ClockPick gets the job done in about 1/5 the time it takes to enter a time value using a traditional select menu UI.</p>
<p><a href="http://www.oakcitygraphics.com/jquery/clockpick/trunk/ClockPick.cfm">Check out the demo here</a></p>
<h3>11. <a href="http://pupunzi.wordpress.com/2009/01/18/mbmenu/">jQuery (mb)Menu 1.5</a></h3>
<p><a href="http://pupunzi.wordpress.com/2009/01/18/mbmenu/"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/29911_jquery-designelements11.jpg" alt="" /></a></p>
<p>This is a powerful jQuery component to build easily a multilevel tree menu or a contextual menu (right click) in an intuitive way! You can add as many submenus as you want; if your submenu or menu is not declared in the page, the component’ll get it via ajax calling the template page with the id of the menu you need (the value of  “menu” attribute) the ajax page should return a well formatted code as the example below for the menu voices code.</p>
<p><a href="http://www.open-lab.com/mb.ideas/index.html#mbMenu">Check out the demo here</a></p>
<h3>12. <a href="http://pupunzi.wordpress.com/2009/02/01/mbcontainersplus/">(mb)ContainersPlus 1.0</a></h3>
<p><a href="http://pupunzi.wordpress.com/2009/02/01/mbcontainersplus/"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/3e1fa_jquery-designelements12.jpg" alt="" /></a></p>
<p>This is a useful plug in to build full featured and full skinnable containers. The container can be set to draggable, resizable, collapsable and minimizable. The container can be set to draggable and resizable by adding &#8220;draggable&#8221; and/or &#8220;resizable&#8221; to the class attribute; there is a custom attribute called buttons that accept: i [iconize], m [minimize], c [close] as value to add buttons to the button-bar. You can also add a left top corner icon by adding the attribute &#8220;icon&#8221; with the icon path as value.</p>
<p><a href="http://www.open-lab.com/mb.ideas/index.html#mbContainerPlus">Check out the demo here</a></p>
<h3>13. <a href="http://www.ollicle.com/2007/jun/03/jquery_lineheight_flexible.html">Auto line-height for flexible layouts</a></h3>
<p><a href="http://www.ollicle.com/2007/jun/03/jquery_lineheight_flexible.html"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/24b92_jquery-designelements13.jpg" alt="" /></a></p>
<p>Adjusts the line-height of a container (such as a div) in proportion to it’s width, relative to the font size.</p>
<p><a href="http://www.ollicle.com/eg/jquery/autolineheight/">Check out the demo here</a></p>
<h3>14. <a href="http://layout.jquery-dev.net/">UI.Layout</a></h3>
<p><a href="http://plugins.jquery.com/project/layout"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/8d4d8_jquery-designelements14.jpg" alt="" /></a></p>
<p>This plugin was inspired by the <a href="http://extjs.com/deploy/dev/examples/layout/complex.html">extJS border-layout</a>, and recreates that functionality as a jQuery plug-in. The UI.Layout plug-in can create any UI look you want &#8211; from simple headers or sidebars, to a complex application with toolbars, menus, help-panels, status bars, sub-forms, etc.</p>
<p><a href="http://layout.jquery-dev.net/demos/complex.html">Check out the demo here</a></p>
<h3>15. <a href="http://franca.exofire.net/jq/colorize">Colorize </a></h3>
<p><a href="http://franca.exofire.net/jq/colorize"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/3e33e_jquery-designelements15.jpg" alt="" /></a></p>
<p>Colorize is a jQuery plugin to add background color to alternate table rows, highlight a row/column on mouse over, and colorize a row/column when you click your mouse button over it. You can colorize as many table rows as you want. A repeat mouse click reverts the row to the original background color.</p>
<p><a href="http://franca.exofire.net/js/demo_plugin_2.html">Check out the demo here</a></p>
<h3>16. <a href="http://www.memorycraft.jp/project/jquery/j3ssw/index.html">jQuery 3 State Switch Plugin</a></h3>
<p><a href="http://www.memorycraft.jp/project/jquery/j3ssw/index.html"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/af764_jquery-designelements16.jpg" alt="" /></a></p>
<p>jQuery 3 State Switch Plugin(J3SSW) is a jQuery Plugin that expresses the selection and some states of list item using radio button and checkbox at the same time. The applications of J3SSW includes some interfaces for sort key or filter key of any search results.</p>
<p><a href="http://www.memorycraft.jp/project/jquery/j3ssw/index.html">Check out the demo here</a></p>
<h3>17. <a href="http://plugins.jquery.com/project/ahover">Animated Hover</a></h3>
<p><a href="http://plugins.jquery.com/project/ahover"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/5d78e_jquery-designelements17.jpg" alt="" /></a></p>
<p>Animated Hover provides animated transitions between hovered items for any jQuery project. Requires jQuery 1.2+ and Dimensions</p>
<p><a href="http://media.brianbeck.com/shared/javascript/jquery-ahover/demo/demo.html">Check out the demo here</a></p>
<h3>18. <a href="http://www.komodomedia.com/blog/2008/10/jquery-feed-menus/">jQuery Feed Menu</a></h3>
<p><a href="http://www.komodomedia.com/blog/2008/10/jquery-feed-menus/"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/5d78e_jquery-designelements18.jpg" alt="" /></a></p>
<p>It’s nice to offer users an alternate way to get at your feeds, here is an easy and standard way of offering your feeds via a nice, compact menu, just like in the location bar, but on your site.</p>
<p><a href="http://www.komodomedia.com/blog/2008/10/jquery-feed-menus/">Check out the demo here</a></p>
<h3>19. <a href="http://www.noupe.com/css/jquery-hover-sub-tag-cloud.html">jquery Hover Sub Tag Cloud</a></h3>
<p><a href="http://www.noupe.com/css/jquery-hover-sub-tag-cloud.html"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/c314c_jquery-designelements19.jpg" alt="" /></a></p>
<p>Here is a new way to create your tag cloud Using jQuery and reduce its size, so my demo will introduce &#8220;Hover Sub Tags&#8221; under each main Tag, for example if you have Ajax as a tag, you can have jquery, mootools, etc… as sub-tags.  A Sub Tag  Cloud will appear when hovering over the main Tag links.</p>
<p><a href="http://www.noupe.com/examples/tagcloud/tag-cloud.html">Check out the demo here</a></p>
<h3>20. <a href="http://www.ihwy.com/Labs/jquery-listnav-plugin.aspx">jQuery ListNav Plugin</a></h3>
<p><a href="http://www.ihwy.com/Labs/jquery-listnav-plugin.aspx"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/e8a08_jquery-designelements20.jpg" alt="" /></a></p>
<p>This jQuery plugin supplies an easy way to unobtrusively add a letter-based navigation widget to any UL or OL list. An easily stylable (via CSS) nav bar appears above the list, showing the user the letters A-through-Z. Clicking one of the letters filters the list to show only the items in the list that start with that letter. Hovering over a letter (optionally) shows a count above the letter, indicating how many items will be displayed if that letter is clicked. Other options give you control over the basic functionality.</p>
<p><a href="http://www.ihwy.com/Labs/Demos/Current/jquery-listnav-plugin.aspx">Check out the demo here</a></p>
<p><a href="http://feeds2.feedburner.com/Devsnippets">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/using-jquery-to-style-design-elements-20-impressive-plugins/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Better Pull Quotes with&#160;MooTools</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/better-pull-quotes-withmootools/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/better-pull-quotes-withmootools/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 16:50:05 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[web resources]]></category>
		<category><![CDATA[background color]]></category>
		<category><![CDATA[Chris]]></category>
		<category><![CDATA[Chris Coyier]]></category>
		<category><![CDATA[David Walsh Blog]]></category>
		<category><![CDATA[Don]]></category>
		<category><![CDATA[element]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[new element]]></category>
		<category><![CDATA[padding]]></category>
		<category><![CDATA[quote]]></category>
		<category><![CDATA[span]]></category>
		<category><![CDATA[span class]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/better-pull-quotes-withmootools/</guid>
		<description><![CDATA[Chris Coyier authored a post titled Better Pull Quotes: Don&#8217;t Repeat Markup a while back. In his post he created great-looking pull quotes without repeating any content &#8212; instead he uses jQuery to dynamically create the pull quotes. The following is the MooTools method for doing so. View Demo The HTML &#60;p&#62;&#60;span class=&#34;pull-me&#34;&#62;As a MooTools [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://davidwalsh.name/dw-content/mootools-pull-quote.php"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/fce5d_pullquotes.png" alt="Pull Quotes" /></a></p>
<p>Chris Coyier authored a post titled <a href="http://css-tricks.com/better-pull-quotes/">Better Pull Quotes: Don&#8217;t Repeat Markup</a> a while back.  In his post he created great-looking pull quotes without repeating any content &#8212; instead he uses jQuery to dynamically create the pull quotes.  The following is the MooTools method for doing so.</p>
<div><a href="http://davidwalsh.name/dw-content/mootools-pull-quote.php">View Demo</a>
<div></div>
</div>
<h2>The HTML</h2>
<pre>
&lt;p&gt;&lt;span class=&quot;pull-me&quot;&gt;As a MooTools &quot;insider&quot;, however, I'm excited for what the MooTools team will bring to the table during 2010.&lt;/span&gt; We'll be launching the Forge (our public plugin repository), releasing MooTools 2, continuing to grow MooTools More, featuring more community work, and much more. MooTools FTW!&lt;/p&gt;
</pre>
<p>The HTML above features a paragraph of content with a SPAN tag wrapping what I&#8217;d like to be the pull quote.</p>
<h2>The CSS</h2>
<pre>
.quote { padding:20px; margin:0 0 20px 20px; font-size:20px; font-style:italic; background:#eee; color:#999; display:block; width:200px; float:right; }
</pre>
<p>You may style the quote any way you&#8217;d like.  These elements are traditionally large in text with italicized text and a different background color.</p>
<h2>The MooTools Javascript</h2>
<pre>
window.addEvent('domready',function() {
	//grab all quotes
	$$('span.pull-me').each(function(span) {
		//inject styled quote into page
		new Element('span',{
			'class': 'quote',
			text: span.get('text')
		}).inject(span.getParent(),'top');
	});
});
</pre>
<p>We find each element with a &#8220;pull-me&#8221; CSS class and generate a new element with our &#8220;quote&#8221; class.  We then inject the new element into the original element&#8217;s parent.  That&#8217;s all!</p>
<div><a href="http://davidwalsh.name/dw-content/mootools-pull-quote.php">View Demo</a>
<div></div>
</div>
<p>Chris did a great job with the execution of his idea.  This is a technique that will likely be used well into the future.</p>
<div>
                                <a href="http://davidwalsh.name/wp-content/plugins/as-pdf/generate.php?post=4292"><br />
                                    <span>Download PDF</span><br />
                                </a>
                            </div>
<p>Don&#8217;t forget to <a href="http://twitter.com/davidwalshblog">follow me on Twitter</a> and be sure to visit <a href="http://scriptandstyle.com">Script &amp; Style</a> for the best Javascript and CSS articles around!</p>
<p><a href="http://buysellads.com/buy/detail/1687">Sponsor the David Walsh Blog</a> and get your brand in front of several thousand users per day!</p>
<p><a href="http://davidwalsh.name/mootools-pull-quotes">Better Pull Quotes with&nbsp;MooTools</a></p>
<p>Related posts:
<ol>
<li><a href="http://davidwalsh.name/highlight-table-columns" rel="bookmark" title="Permanent Link: Highlight Table Rows, Columns, and Cells Using MooTools 1.2.3">Highlight Table Rows, Columns, and Cells Using MooTools&nbsp;1.2.3</a></li>
<li><a href="http://davidwalsh.name/predictions-2010" rel="bookmark" title="Permanent Link: Bold Web Predictions for 2010">Bold Web Predictions for&nbsp;2010</a></li>
<li><a href="http://davidwalsh.name/mootools-html-police-dwmarkupmarine" rel="bookmark" title="Permanent Link: MooTools HTML Police: dwMarkupMarine">MooTools HTML Police:&nbsp;dwMarkupMarine</a></li>
<li><a href="http://davidwalsh.name/method-chaining" rel="bookmark" title="Permanent Link: Method Chaining in MooTools and PHP">Method Chaining in MooTools and&nbsp;PHP</a></li>
<li><a href="http://davidwalsh.name/image-protector-plugin-for-jquery" rel="bookmark" title="Permanent Link: dwImageProtector Plugin for jQuery">dwImageProtector Plugin for&nbsp;jQuery</a></li>
</ol>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/fce5d_NCxy8TQwalw" height="1" width="1" /><br />
<a href="http://davidwalsh.name/feed/atom">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/web-resources/better-pull-quotes-withmootools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

