<?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>Bagesh Singh&#039;s Blog &#187; ajax</title>
	<atom:link href="http://www.bageshsingh.com/bagesh-blog/category/ajax/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bageshsingh.com/bagesh-blog</link>
	<description>Shortest Distance to  Web Solutions &#38; Software Solutions</description>
	<lastBuildDate>Wed, 22 Feb 2012 18:42:12 +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>Jquery Mouseover Tooltip Plugin</title>
		<link>http://www.bageshsingh.com/bagesh-blog/2011/07/jquery-mouseover-tooltip-plugin/</link>
		<comments>http://www.bageshsingh.com/bagesh-blog/2011/07/jquery-mouseover-tooltip-plugin/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 18:49:36 +0000</pubDate>
		<dc:creator>Bagesh Singh</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[Home]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[Interview Question]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://www.bageshsingh.com/bagesh-blog/?p=1405</guid>
		<description><![CDATA[Let&#8217;s review a topic about how to create Jquery Mouseover Tooltip Plugin. Have you ever seen Jquery Mouseover Tooltip Plugin ? &#8230; Like this below: Link Nudging Or, Naruto Image How to do ? &#8230; 1. Go to Dashboard, click Design, click Edit HTML 2. Find code of HTML below: &#60;/head&#62; you can use (Ctrl+F) [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s review a topic about how to create Jquery Mouseover Tooltip Plugin. Have you ever seen Jquery Mouseover Tooltip Plugin ? &#8230;</p>
<p>Like this below:</p>
<p>Link Nudging</p>
<p>Or,</p>
<p>Naruto Image</p>
<p>How to do ? &#8230;<br />
<a name="more"></a><br />
1. Go to Dashboard, click Design, click Edit HTML</p>
<p>2. Find code of HTML below:</p>
<div>&lt;/head&gt;</div>
<p>you can use (Ctrl+F) to find easily</p>
<p>3. Right Before <strong>&lt;/head&gt;</strong> &#8211; place code of HTML below:</p>
<div>&lt;!&#8211;Jquery-Tooltip-BEGIN&#8211;&gt;<br />
&lt;script src=&#8221;jquery.js&#8221; type=&#8221;text/javascript&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;jquery.hoverIntent.js&#8221; type=&#8221;text/javascript&#8221;&gt;&lt;/script&gt; &lt;!&#8211; optional &#8211;&gt;<br />
&lt;script src=&#8221;jquery.cluetip.js&#8221; type=&#8221;text/javascript&#8221;&gt;&lt;/script&gt;</p>
<p>&lt;script type=&#8221;text/javascript&#8221;&gt;<br />
$(document).ready(function() {<br />
$(&#8216;a.tips&#8217;).cluetip();</p>
<p>$(&#8216;#houdini&#8217;).cluetip({<br />
splitTitle: &#8216;|&#8217;, // use the invoking element&#8217;s title attribute to populate the clueTip&#8230;<br />
// &#8230;and split the contents into separate divs where there is a &#8220;|&#8221;<br />
showTitle: false // hide the clueTip&#8217;s heading<br />
});<br />
});<br />
&lt;/script&gt;<br />
&lt;link rel=&#8221;stylesheet&#8221; href=&#8221;jquery.cluetip.css&#8221; type=&#8221;text/css&#8221; /&gt;<br />
&lt;!&#8211;Jquery-Tooltip-END-http://tutorialwebforblogger.blogspot.com&#8211;&gt;</p></div>
<p>4. Click Save Template.</p>
<p>5. Example of how to use Jquery Mouseover Tooltip Plugin to other link:</p>
<div>&lt;a href=&#8221;http://tutorialwebforblogger.blogspot.com/2010/03/jquery-link-nudging-plugin.html&#8221; id=&#8221;nudging&#8221; title=&#8221;Click to see how to create jquery link nudging plugin.&#8221;&gt;Link Nudging&lt;/a&gt;</div>
<p>6. Example of how to use Jquery Mouseover Tooltip Plugin to image:</p>
<div>&lt;a href=&#8221;http://2.bp.blogspot.com/_rg7WY6fRQ4M/RtrIBP91cfI/AAAAAAAAATw/2L8EM1m5950/s1600/Naruto%252BWallpaper%252BUzumaki%252BNaruto%252B1.jpg&#8221; id=&#8221;naruto&#8221; title=&#8221;Click to see image of Naruto Uzumaki.&#8221;&gt;Naruto Image&lt;/a&gt;</div>
<p>Done, Now, you&#8217;ve already created Jquery Mouseover Tooltip Plugin.</p>
<div id="seo_alrp_related"><h2>Posts Related to Jquery Mouseover Tooltip Plugin</h2><ul><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/02/add-a-%e2%80%9cread-more%e2%80%9d-link-using-jquery/" rel="bookmark">Add a “Read More” Link using jQuery</a></h3><p>The jQuery Expander Plugin is a simple little jQuery plugin to hide/collapse a portion of an element's text and add a "read more" link so ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/jquery-thumbnail-image-with-heading-and-caption/" rel="bookmark">Jquery Thumbnail Image with Heading and Caption</a></h3><p>Let's review a topic about how to create a Jquery Thumbnail Image with Heading and Caption. Have you ever seen Jquery Thumbnail Image with Heading ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2010/11/quick-easy-way-to-implement-drag-n-share-with-jquery/" rel="bookmark">Quick &#038; Easy Way to Implement Drag n Share With jQuery</a></h3><p>You must have seen the drag to share functionality on Mashable that lets visitors share the content on popular social networks intuitively. Just drag one ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2010/11/jquery-plugin-word-counter-textarea/" rel="bookmark">jQuery plugin: word-counter for textarea</a></h3><p>Sorry friends on the way of move to new home I’ve been lost from the blog as I didn’t have internet connection for few last ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/02/how-to-create-a-simple-slider-using-jquery/" rel="bookmark">How to Create a Simple Slider Using jQuery</a></h3><p>Did you know what is jquery? Jquery is a cross browser JavaScript library designed to simplify the client-side scripting of HTML. Jquery is free, open ...</p></div></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.bageshsingh.com/bagesh-blog/2011/07/jquery-mouseover-tooltip-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jquery Thumbnail Image with Heading and Caption</title>
		<link>http://www.bageshsingh.com/bagesh-blog/2011/07/jquery-thumbnail-image-with-heading-and-caption/</link>
		<comments>http://www.bageshsingh.com/bagesh-blog/2011/07/jquery-thumbnail-image-with-heading-and-caption/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 18:48:00 +0000</pubDate>
		<dc:creator>Bagesh Singh</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[Home]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://www.bageshsingh.com/bagesh-blog/?p=1403</guid>
		<description><![CDATA[Let&#8217;s review a topic about how to create a Jquery Thumbnail Image with Heading and Caption. Have you ever seen Jquery Thumbnail Image with Heading and Caption ? &#8230; Like this below: Click Here to See the Example how to create a Jquery Thumbnail Image with Heading and Caption ? &#8230; First Step; 1. Go [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s review a topic about how to create a Jquery Thumbnail Image with Heading and Caption.<br />
Have you ever seen Jquery Thumbnail Image with Heading and Caption ? &#8230;</p>
<p>Like this below:</p>
<p>Click Here to See the Example</p>
<p>how to create a Jquery Thumbnail Image with Heading and Caption ? &#8230;<br />
<a name="more"></a><br />
<strong>First Step;</strong></p>
<p>1. Go to Dashboard, click Design, click Edit HTML</p>
<p>2. Find code of HTML below:</p>
<div>&lt;/head&gt;</div>
<p>you can use (Ctrl+F) to find easily</p>
<p>3. Right Before <strong>&lt;/head&gt; </strong>- place code of HTML below:</p>
<div>&lt;script type=&#8221;text/javascript&#8221; src=&#8221;http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script&gt;$(document).ready(function () {</p>
<p>// transition effect<br />
style = &#8216;easeOutQuart&#8217;;</p>
<p>// if the mouse hover the image<br />
$(&#8216;.photo&#8217;).hover(<br />
function() {<br />
//display heading and caption<br />
$(this).children(&#8216;div:first&#8217;).stop(false,true).animate({top:0},{duration:200, easing: style});<br />
$(this).children(&#8216;div:last&#8217;).stop(false,true).animate({bottom:0},{duration:200, easing: style});<br />
},</p>
<p>function() {<br />
//hide heading and caption<br />
$(this).children(&#8216;div:first&#8217;).stop(false,true).animate({top:-50},{duration:200, easing: style});<br />
$(this).children(&#8216;div:last&#8217;).stop(false,true).animate({bottom:-50},{duration:200, easing: style});<br />
}<br />
);</p>
<p>});&lt;/script&gt;</p></div>
<p>4. Find code of HTML below:</p>
<div> ]]&gt;&lt;/b:skin&gt;</div>
<p>you can use (Ctrl+F) to find easily</p>
<p>5. Right Before <strong> ]]&gt;&lt;/b:skin&gt;</strong> &#8211; place code of HTML below:</p>
<div>&lt;!&#8211;Jquery-Thumbnail-BEGIN&#8211;&gt;<br />
.photo {<br />
/* relative position, so that objects in it can be positioned inside this container */<br />
position:relative;<br />
font-family:arial;<br />
/* hide those extra height that goes beyong the size of this container */<br />
overflow:hidden;<br />
border:5px solid #000;<br />
width:350px;<br />
height:186px;<br />
}<br />
.photo .heading, .photo .caption {<br />
/* position inside the container */<br />
position:absolute;<br />
background:#000;<br />
height:50px;<br />
width:350px;<br />
/* transparency for different browsers */<br />
/* i have shared this in my CSS tips post too */<br />
opacity:0.6;<br />
filter:alpha(opacity=60);<br />
-moz-opacity:0.6;<br />
-khtml-opacity: 0.6;</p>
<p>}<br />
.photo .heading {<br />
/* hide it with negative value */<br />
/* it&#8217;s the height of heading class */<br />
top:-50px;<br />
}</p>
<p>.photo .caption {<br />
/* hide it with negative value */<br />
/* it&#8217;s the height of bottom class */<br />
bottom:-50px;<br />
}</p>
<p>/* styling of the classes*/<br />
.photo .heading span {</p>
<p>color:#26c3e5;<br />
top:-50px;<br />
font-weight:bold;<br />
display:block;<br />
padding:5px 0 0 10px;<br />
}<br />
.photo .caption span{<br />
color:#999;<br />
font-size:12px;<br />
display:block;<br />
padding:5px 10px 0 10px;<br />
}<br />
&lt;!&#8211;Jquery-Thumbnail-END-http://tutorialwebforblogger.blogspot.com&#8211;&gt;</p></div>
<p>6. Click Save Template.</p>
<p><strong>Second Step;</strong></p>
<p>1. Go to Dashboard, click Design, click Add a Gadget</p>
<p>2. Click &#8216;HTML/JavaScript&#8217;</p>
<p>3. Place code of HTML below &#8211; into &#8216;HTML/JavaScript&#8217;</p>
<div>&lt;div&gt;<br />
&lt;div&gt;&lt;span&gt;Blogfuel: Widgets and SEO&lt;/span&gt;&lt;/div&gt;<br />
&lt;img src=&#8221;http://www.cmsnl.com/news/img/fuel_station_gas_nozzle.jpg&#8221; width=&#8221;340px&#8221; height=&#8221;175&#8243; alt=&#8221;" /&gt;<br />
&lt;div&gt;&lt;span&gt;This is Example of Jquery Thumbnail Image with Heading and Caption&lt;/span&gt;&lt;/div&gt;<br />
&lt;/div&gt;</div>
<div id="seo_alrp_related"><h2>Posts Related to Jquery Thumbnail Image with Heading and Caption</h2><ul><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/jquery-mouseover-tooltip-plugin/" rel="bookmark">Jquery Mouseover Tooltip Plugin</a></h3><p>Let's review a topic about how to create Jquery Mouseover Tooltip Plugin. Have you ever seen Jquery Mouseover Tooltip Plugin ? ... Like this below: ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2010/11/expandable-collapsible-toggle-pane-jquery/" rel="bookmark">Expand-collapse toggle panel (div) using jquery</a></h3><p>In this post, I’ll show you how easy it is to show expandable and collapsible toggle panel using jQuery. When you click on the heading, ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/how-to-add-sweet-thumbnails-preview-gallery/" rel="bookmark">how to add Sweet Thumbnails Preview Gallery</a></h3><p>The Markup The HTML structure is going to consist of a main container which will have the image wrapper for the big image, the navigation ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/css-and-jquery-tutorial-fancy-apple-style-icon-slide-out-navigation/" rel="bookmark">CSS and jQuery Tutorial: Fancy Apple-Style Icon Slide Out Navigation</a></h3><p>1. The HTML The markup just consists of a div with an unordered list inside. The list elements contain a span for the icon and ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/08/ife-ifempty-function-with-clearbox-in-cakephp/" rel="bookmark">Ife (ifempty) Function With Clearbox in CakePHP</a></h3><p>I use it in this way. 1 2 3 //If member_image will empty then set 'no-photo.jpg' as default image $thumb_photo = ife($member['Member']['member_image'], $member['Member']['member_image'], "no-photo.jpg"); Optional: ...</p></div></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.bageshsingh.com/bagesh-blog/2011/07/jquery-thumbnail-image-with-heading-and-caption/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sliding Letters with jQuery</title>
		<link>http://www.bageshsingh.com/bagesh-blog/2011/07/sliding-letters-with-jquery/</link>
		<comments>http://www.bageshsingh.com/bagesh-blog/2011/07/sliding-letters-with-jquery/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 18:46:50 +0000</pubDate>
		<dc:creator>Bagesh Singh</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[Home]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://www.bageshsingh.com/bagesh-blog/?p=1401</guid>
		<description><![CDATA[Example In the following we will go through an example and we’ll start by the html for a little menu: 1 &#60;div class="sl_examples"&#62; 2     &#60;a href="#" id="example1" data-hover="Creativity"&#62;Illustrations&#60;/a&#62; 3 &#60;/div&#62; We will use data-hover to indicate the word that should appear on hover. If you don’t use the data-hover then the same word will be [...]]]></description>
			<content:encoded><![CDATA[<h3>Example</h3>
<p>In the following we will go through an example and we’ll start by the html for a little menu:</p>
<div id="highlighter_684372">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>&lt;</code><code>div</code> <code>class</code><code>=</code><code>"sl_examples"</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>    </code><code>&lt;</code><code>a</code> <code>href</code><code>=</code><code>"#"</code> <code>id</code><code>=</code><code>"example1"</code> <code>data-hover</code><code>=</code><code>"Creativity"</code><code>&gt;Illustrations&lt;/</code><code>a</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>&lt;/</code><code>div</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>We will use data-hover to indicate the word that should appear on hover. If you don’t use the data-hover then the same word will be used on hover.<br />
Then we will style it in the following way, making sure that we have the right properties for the structure that will be generated:</p>
<div id="highlighter_288362">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>.sl_examples{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>float</code><code>:</code><code>left</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>font-family</code><code>: </code><code>'Bevan'</code><code>, </code><code>arial</code><code>, </code><code>serif</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>font-size</code><code>:</code><code>50px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>line-height</code><code>:</code><code>50px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>    </code><code>color</code><code>:</code><code>#f0f0f0</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>margin-right</code><code>:</code><code>5px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>text-transform</code><code>:</code><code>uppercase</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>.sl_examples a{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>    </code><code>display</code><code>:</code><code>block</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>    </code><code>position</code><code>:</code><code>relative</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>    </code><code>float</code><code>:</code><code>left</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>    </code><code>clear</code><code>:</code><code>both</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>    </code><code>color</code><code>:</code><code>#fff</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>17</code></td>
<td><code>.sl_examples a &gt; span{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>18</code></td>
<td><code>    </code><code>height</code><code>:</code><code>50px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>19</code></td>
<td><code>    </code><code>float</code><code>:</code><code>left</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>20</code></td>
<td><code>    </code><code>position</code><code>:</code><code>relative</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>21</code></td>
<td><code>    </code><code>overflow</code><code>:</code><code>hidden</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>22</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>23</code></td>
<td><code>.sl_examples a span span{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>24</code></td>
<td><code>    </code><code>position</code><code>:</code><code>absolute</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>25</code></td>
<td><code>    </code><code>display</code><code>:</code><code>block</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>26</code></td>
<td><code>    </code><code>left</code><code>:</code><code>0px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>27</code></td>
<td><code>    </code><code>top</code><code>:</code><code>0px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>28</code></td>
<td><code>    </code><code>text-align</code><code>:</code><code>center</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>29</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>30</code></td>
<td><code>.sl_examples a span span.sl-w</code><code>1</code><code>{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>31</code></td>
<td><code>    </code><code>color</code><code>:</code><code>#fff</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>32</code></td>
<td><code>    </code><code>text-shadow</code><code>:</code><code>0px</code> <code>0px</code> <code>1px</code> <code>#fff</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>33</code></td>
<td><code>    </code><code>z-index</code><code>:</code><code>2</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>34</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>35</code></td>
<td><code>.sl_examples a span span.sl-w</code><code>2</code><code>{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>36</code></td>
<td><code>    </code><code>color</code><code>:</code><code>#e82760</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>37</code></td>
<td><code>    </code><code>text-shadow</code><code>:</code><code>-1px</code> <code>1px</code> <code>2px</code> <code>#9f0633</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>38</code></td>
<td><code>    </code><code>z-index</code><code>:</code><code>3</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>39</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>So, “sl-w1″ is the class for the first word letters and “sl-w2″ is the class for the second word letters.</p>
<p>Finally, we call the plugin:</p>
<div id="highlighter_119201">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>$(window).load(</code><code>function</code><code>(){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>    </code><code>$(</code><code>'#example1'</code><code>).hoverwords({ delay:50 });</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>});</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The following settings can be used:</p>
<div id="highlighter_446859">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>delay       : </code><code>false</code><code>,        </code><code>// each letter will have different animation times</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>speed       : 300,          </code><code>// animation speed</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>easing      : </code><code>'jswing'</code><code>,     </code><code>// easing animation</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>dir         : </code><code>'leftright'</code><code>,  </code><code>// leftright - current goes left, new one goes right || rightleft - current goes right, new one goes left,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code>overlay     : </code><code>false</code><code>,        </code><code>// hover word is slided on top of the current word (just for the case when the hover word equals word)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>6</code></td>
<td><code>opacity     : </code><code>true</code>          <code>// animate the letters opacity</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>We hope you liked this little experiment and find it useful!</p>
<p><a href="http://tympanus.net/Development/SlidingLetters/" target="_blank">Download source</a></p>
<div><ins><ins id="aswift_0_anchor"><br />
</ins></ins></div>
<div id="seo_alrp_related"><h2>Posts Related to Sliding Letters with jQuery</h2><ul><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2010/11/jquery-plugin-word-counter-textarea/" rel="bookmark">jQuery plugin: word-counter for textarea</a></h3><p>Sorry friends on the way of move to new home I’ve been lost from the blog as I didn’t have internet connection for few last ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/jquery-thumbnail-image-with-heading-and-caption/" rel="bookmark">Jquery Thumbnail Image with Heading and Caption</a></h3><p>Let's review a topic about how to create a Jquery Thumbnail Image with Heading and Caption. Have you ever seen Jquery Thumbnail Image with Heading ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/css-and-jquery-tutorial-fancy-apple-style-icon-slide-out-navigation/" rel="bookmark">CSS and jQuery Tutorial: Fancy Apple-Style Icon Slide Out Navigation</a></h3><p>1. The HTML The markup just consists of a div with an unordered list inside. The list elements contain a span for the icon and ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2010/11/sleek-and-smooth-animated-menu-jquery/" rel="bookmark">Sleek and Smooth animated menu using jQuery</a></h3><p>Today, I’m going to show you something interesting with jQuery. Yesterday I was thinking something to post something programming related stuff  in blog after long ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/all-fixed-fade-out-menu-a-css-and-jquery-tutorial/" rel="bookmark">all Fixed Fade Out Menu: A CSS and jQuery Tutorial</a></h3><p>1. The HTML The markup is pretty simple: we have a div with a list inside. The list items will be our links, the search ...</p></div></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.bageshsingh.com/bagesh-blog/2011/07/sliding-letters-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS and jQuery Tutorial: Fancy Apple-Style Icon Slide Out Navigation</title>
		<link>http://www.bageshsingh.com/bagesh-blog/2011/07/css-and-jquery-tutorial-fancy-apple-style-icon-slide-out-navigation/</link>
		<comments>http://www.bageshsingh.com/bagesh-blog/2011/07/css-and-jquery-tutorial-fancy-apple-style-icon-slide-out-navigation/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 18:45:56 +0000</pubDate>
		<dc:creator>Bagesh Singh</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[Home]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://www.bageshsingh.com/bagesh-blog/?p=1399</guid>
		<description><![CDATA[1. The HTML The markup just consists of a div with an unordered list inside. The list elements contain a span for the icon and the link element: 01 &#60;div class="navigation"&#62; 02  &#60;ul class="menu" id="menu"&#62; 03     &#60;li&#62;&#60;span class="ipod"&#62;&#60;/span&#62;&#60;a href="" class="first"&#62;Players&#60;/a&#62;&#60;/li&#62; 04     &#60;li&#62;&#60;span class="video_camera"&#62;&#60;/span&#62;&#60;a href=""&#62;Cameras&#60;/a&#62;&#60;/li&#62; 05     &#60;li&#62;&#60;span class="television"&#62;&#60;/span&#62;&#60;a href=""&#62;TVs&#60;/a&#62;&#60;/li&#62; 06     &#60;li&#62;&#60;span class="monitor"&#62;&#60;/span&#62;&#60;a href=""&#62;Screens&#60;/a&#62;&#60;/li&#62; 07     &#60;li&#62;&#60;span class="toolbox"&#62;&#60;/span&#62;&#60;a [...]]]></description>
			<content:encoded><![CDATA[<h3>1. The HTML</h3>
<p>The markup just consists of a div with an unordered list inside. The list elements contain a span for the icon and the link element:</p>
<div id="highlighter_268063">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>&lt;</code><code>div</code> <code>class</code><code>=</code><code>"navigation"</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code> </code><code>&lt;</code><code>ul</code> <code>class</code><code>=</code><code>"menu"</code> <code>id</code><code>=</code><code>"menu"</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>&lt;</code><code>li</code><code>&gt;&lt;</code><code>span</code> <code>class</code><code>=</code><code>"ipod"</code><code>&gt;&lt;/</code><code>span</code><code>&gt;&lt;</code><code>a</code> <code>href</code><code>=</code><code>""</code> <code>class</code><code>=</code><code>"first"</code><code>&gt;Players&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>&lt;</code><code>li</code><code>&gt;&lt;</code><code>span</code> <code>class</code><code>=</code><code>"video_camera"</code><code>&gt;&lt;/</code><code>span</code><code>&gt;&lt;</code><code>a</code> <code>href</code><code>=</code><code>""</code><code>&gt;Cameras&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>&lt;</code><code>li</code><code>&gt;&lt;</code><code>span</code> <code>class</code><code>=</code><code>"television"</code><code>&gt;&lt;/</code><code>span</code><code>&gt;&lt;</code><code>a</code> <code>href</code><code>=</code><code>""</code><code>&gt;TVs&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>    </code><code>&lt;</code><code>li</code><code>&gt;&lt;</code><code>span</code> <code>class</code><code>=</code><code>"monitor"</code><code>&gt;&lt;/</code><code>span</code><code>&gt;&lt;</code><code>a</code> <code>href</code><code>=</code><code>""</code><code>&gt;Screens&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>&lt;</code><code>li</code><code>&gt;&lt;</code><code>span</code> <code>class</code><code>=</code><code>"toolbox"</code><code>&gt;&lt;/</code><code>span</code><code>&gt;&lt;</code><code>a</code> <code>href</code><code>=</code><code>""</code><code>&gt;Tools&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>&lt;</code><code>li</code><code>&gt;&lt;</code><code>span</code> <code>class</code><code>=</code><code>"telephone"</code><code>&gt;&lt;/</code><code>span</code><code>&gt;&lt;</code><code>a</code> <code>href</code><code>=</code><code>""</code><code>&gt;Phones&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>    </code><code>&lt;</code><code>li</code><code>&gt;&lt;</code><code>span</code> <code>class</code><code>=</code><code>"print"</code><code>&gt;&lt;/</code><code>span</code><code>&gt;&lt;</code><code>a</code> <code>href</code><code>=</code><code>""</code> <code>class</code><code>=</code><code>"last"</code><code>&gt;Printers&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code> </code><code>&lt;/</code><code>ul</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>&lt;/</code><code>div</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<h3>2. The CSS</h3>
<p>The style of the navigation container and the unordered list will be the following:</p>
<div id="highlighter_317164">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>.navigation{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>position</code><code>:</code><code>relative</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>margin</code><code>:</code><code>0</code> <code>auto</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>width</code><code>:</code><code>915px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>ul.menu{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>list-style</code><code>:</code><code>none</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>font-family</code><code>:</code><code>"Verdana"</code><code>,</code><code>sans-serif</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>    </code><code>border-top</code><code>:</code><code>1px</code> <code>solid</code> <code>#bebebe</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>    </code><code>margin</code><code>:</code><code>0px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>    </code><code>padding</code><code>:</code><code>0px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>    </code><code>float</code><code>:</code><code>left</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>ul.menu li{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>    </code><code>float</code><code>:</code><code>left</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>Since we are making the list float, we will need some relative wrapper for the icons. You see, the icons which will be the background-images of the spans in our list, will have absolute positioning. That comes handy when you need to define a z-index, i.e. saying that some element is on top or under another one. Since we want the icons to appear on top and then dissapear under the link element, we will have to deal with z-indeces. And absolute positioning of elements in a relative container will makes things easier.</p>
<p>Now, let’s define the style for the link elements:</p>
<div id="highlighter_173548">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>ul.menu li a{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>text-decoration</code><code>:</code><code>none</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>background</code><code>:</code><code>#7E7E7E</code> <code>url</code><code>(../images/bgMenu.png) </code><code>repeat-x</code> <code>top</code> <code>left</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>padding</code><code>:</code><code>15px</code> <code>0px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>width</code><code>:</code><code>128px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>    </code><code>color</code><code>:</code><code>#333333</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>float</code><code>:</code><code>left</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>text-align</code><code>:</code><code>center</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>    </code><code>border-right</code><code>:</code><code>1px</code> <code>solid</code> <code>#a1a1a1</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>    </code><code>border-left</code><code>:</code><code>1px</code> <code>solid</code> <code>#e8e8e8</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>    </code><code>font-weight</code><code>:</code><code>bold</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>    </code><code>font-size</code><code>:</code><code>13px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>    </code><code>-moz-</code><code>box-shadow</code><code>: </code><code>0</code> <code>1px</code> <code>3px</code> <code>#555</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>    </code><code>-webkit-</code><code>box-shadow</code><code>: </code><code>0</code> <code>1px</code> <code>3px</code> <code>#555</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>    </code><code>text-shadow</code><code>: </code><code>0</code> <code>1px</code> <code>1px</code> <code>#fff</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>We want to give the link elements a fixed width and some background gradient. The borders will create a nice inset effect.</p>
<p>The next hover class will be applied using jQuery, since the :hover pseudo class creates an unwanted effect: When the icon slides out it covers the link for a few milliseconds, making the hover style dissapear in that time. That is perceived as a flicker and we will avoid that by defining a class that we will simply add with jQuery when we do the icon slide out effect:</p>
<div id="highlighter_800664">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ul.menu li a.hover{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>    </code><code>background-image</code><code>:</code><code>none</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>    </code><code>color</code><code>:</code><code>#fff</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>    </code><code>text-shadow</code><code>: </code><code>0</code> <code>-1px</code> <code>1px</code> <code>#000</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The first and last link element should have a rounded border on the respective side, so we define two classes for those:</p>
<div id="highlighter_767494">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ul.menu li a.first{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>    </code><code>-moz-border-radius:</code><code>0px</code> <code>0px</code> <code>0px</code> <code>10px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>    </code><code>-webkit-border-bottom-left-radius: </code><code>10px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>    </code><code>border-left</code><code>:</code><code>none</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>6</code></td>
<td><code>ul.menu li a.last{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>7</code></td>
<td><code>    </code><code>-moz-border-radius:</code><code>0px</code> <code>0px</code> <code>10px</code> <code>0px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>8</code></td>
<td><code>    </code><code>-webkit-border-bottom-right-radius: </code><code>10px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>9</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The common style for all the icon spans will be the following:</p>
<div id="highlighter_956365">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>ul.menu li span{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>width</code><code>:</code><code>64px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>height</code><code>:</code><code>64px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>background-repeat</code><code>:</code><code>no-repeat</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>background-color</code><code>:</code><code>transparent</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>    </code><code>position</code><code>:</code><code>absolute</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>z-index</code><code>:</code><code>-1</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>top</code><code>:</code><code>80px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>    </code><code>cursor</code><code>:</code><code>pointer</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The single styles for the specific icons will contain the background-image and the x-position:</p>
<div id="highlighter_462772">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>ul.menu li span.ipod{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>background-image</code><code>:</code><code>url</code><code>(../icons/ipod.png);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>left</code><code>:</code><code>33px</code><code>; </code><code>/*128/2 - 32(half of icon) +1 of border*/</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>ul.menu li span.video_camera{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>    </code><code>background-image</code><code>:</code><code>url</code><code>(../icons/video_camera.png);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>left</code><code>:</code><code>163px</code><code>; </code><code>/* plus 128 + 2px of border*/</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>ul.menu li span.television{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>    </code><code>background-image</code><code>:</code><code>url</code><code>(../icons/television.png);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>    </code><code>left</code><code>:</code><code>293px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>ul.menu li span.monitor{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>    </code><code>background-image</code><code>:</code><code>url</code><code>(../icons/monitor.png);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>    </code><code>left</code><code>:</code><code>423px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>17</code></td>
<td><code>ul.menu li span.toolbox{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>18</code></td>
<td><code>    </code><code>background-image</code><code>:</code><code>url</code><code>(../icons/toolbox.png);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>19</code></td>
<td><code>    </code><code>left</code><code>:</code><code>553px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>20</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>21</code></td>
<td><code>ul.menu li span.telephone{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>22</code></td>
<td><code>    </code><code>background-image</code><code>:</code><code>url</code><code>(../icons/telephone.png);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>23</code></td>
<td><code>    </code><code>left</code><code>:</code><code>683px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>24</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>25</code></td>
<td><code>ul.menu li span.</code><code>print</code><code>{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>26</code></td>
<td><code>    </code><code>background-image</code><code>:</code><code>url</code><code>(../icons/</code><code>print</code><code>.png);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>27</code></td>
<td><code>    </code><code>left</code><code>:</code><code>813px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>28</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>As you can see, we are positioning the icons in such a way, that they are centered inside of the list element. The top position is 80px initially since we want to show them to the user when the page get’s loaded. Then we will hide them in a stair-like fashion to create an awesome effect!</p>
<h3>3. The JavaScript</h3>
<p>First, we want to create the effect of the icons dissapearing in a stair-like fashion and then we will define the hover function for the list elements:</p>
<div id="highlighter_35945">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>$(</code><code>function</code><code>() {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>var</code> <code>d=1000;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>$(</code><code>'#menu span'</code><code>).each(</code><code>function</code><code>(){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>        </code><code>$(</code><code>this</code><code>).stop().animate({</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>            </code><code>'top'</code><code>:</code><code>'-17px'</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>        </code><code>},d+=250);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>});</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>    </code><code>$(</code><code>'#menu &gt; li'</code><code>).hover(</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>        </code><code>function</code> <code>() {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>            </code><code>var</code> <code>$</code><code>this</code> <code>= $(</code><code>this</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>            </code><code>$(</code><code>'a'</code><code>,$</code><code>this</code><code>).addClass(</code><code>'hover'</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>            </code><code>$(</code><code>'span'</code><code>,$</code><code>this</code><code>).stop().animate({</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>                </code><code>'top'</code><code>:</code><code>'40px'</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>            </code><code>},300).css({</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>                </code><code>'zIndex'</code><code>:</code><code>'10'</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>17</code></td>
<td><code>            </code><code>});</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>18</code></td>
<td><code>        </code><code>},</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>19</code></td>
<td><code>        </code><code>function</code> <code>() {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>20</code></td>
<td><code>            </code><code>var</code> <code>$</code><code>this</code> <code>= $(</code><code>this</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>21</code></td>
<td><code>            </code><code>$(</code><code>'a'</code><code>,$</code><code>this</code><code>).removeClass(</code><code>'hover'</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>22</code></td>
<td><code>            </code><code>$(</code><code>'span'</code><code>,$</code><code>this</code><code>).stop().animate({</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>23</code></td>
<td><code>                </code><code>'top'</code><code>:</code><code>'-17px'</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>24</code></td>
<td><code>            </code><code>},800).css({</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>25</code></td>
<td><code>                </code><code>'zIndex'</code><code>:</code><code>'-1'</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>26</code></td>
<td><code>            </code><code>});</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>27</code></td>
<td><code>        </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>28</code></td>
<td><code>    </code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>29</code></td>
<td><code>});</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>When hovering, we add the class “hover” to the link element, make the icon appear from the top, and increase the z-Index, so that the icon stays on top of the link. When the mouse goes out, we do exactly the opposite, which creates the effect that the icon dissapears behind the link element. For that we will allow more time (800 milliseconds) because it’s such a fun effect that the user might want to enjoy a little bit!</p>
<p>And that’s all!<br />
I hope you like and enjoy it!</p>
<p>D<a href="http://www.tympanus.net/Tutorials/FancyAppleStyleNavigation/FancyAppleStyleNavigation.zip">ownload source</a></p>
<p>&nbsp;</p>
<div id="seo_alrp_related"><h2>Posts Related to CSS and jQuery Tutorial: Fancy Apple-Style Icon Slide Out Navigation</h2><ul><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/all-fixed-fade-out-menu-a-css-and-jquery-tutorial/" rel="bookmark">all Fixed Fade Out Menu: A CSS and jQuery Tutorial</a></h3><p>1. The HTML The markup is pretty simple: we have a div with a list inside. The list items will be our links, the search ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/how-to-add-beautiful-slide-out-navigation-a-css-and-jquery-tutorial/" rel="bookmark">how to add Beautiful Slide Out Navigation: A CSS and jQuery Tutorial</a></h3><p>1. The HTML Structure The only thing we will need for the navigation is a simple unordered list with links inside of the list elements: ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2010/11/sleek-and-smooth-animated-menu-jquery/" rel="bookmark">Sleek and Smooth animated menu using jQuery</a></h3><p>Today, I’m going to show you something interesting with jQuery. Yesterday I was thinking something to post something programming related stuff  in blog after long ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/how-to-add-sweet-thumbnails-preview-gallery/" rel="bookmark">how to add Sweet Thumbnails Preview Gallery</a></h3><p>The Markup The HTML structure is going to consist of a main container which will have the image wrapper for the big image, the navigation ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2010/11/color-palette-generator-using-jqueryas-i-continue-to-learn-jquery-i-think-its-important-that-i-begin-by-porting-over-scripts-ive-created-using-mootools-one-of-those-scripts-is-my-color-palette-g/" rel="bookmark">Color Palette Generator Using jQueryAs I continue to learn jQuery, I think it&#8217;s important that I begin by porting over scripts I&#8217;ve created using MooTools. One of those scripts is my Color Palette Generator script, which debuted on Eric Wendelin&#8217;s blog. For those of you that missed it, my script analyzes all of the colors on the page (minus images) and builds a palette of colors. Here it is in some jQuery goodness.  The XHTML  <input type="button" id="get-colors" value="Get Colors" class="button" /> <div id="colors-wrapper"></div>  All we need to begin with is the button that triggers the palette generation and a DIV container that will hold all of the DIVs my jQuery creates. The CSS  .dcolor { height:40px; } .dtext {  } .dwrapper { width:200px; float:left; padding:10px; margin:0 20px 20px 0; border:1px solid #ccc; }   These CSS classes act as containers for the text DIV I generate and the color-displaying DIV I generate. Those two DIVs are held in one wrapping DIV. The jQuery JavaScript  /* when the dom is ready */ $(document).ready(function() { $(&#8216;#get-colors&#8217;).click(function() {   //my colors array var colors = new Array(); //get all elements $(&#8216;*&#8217;).each(function() { if($(this).css(&#8216;background-color&#8217;) &#038;&#038; $(this).css(&#8216;background-color&#8217;) != &#8216;transparent&#8217;) { colors.push($(this).css(&#8216;background-color&#8217;)); } if($(this).css(&#8216;color&#8217;)) { colors.push($(this).css(&#8216;color&#8217;)); } if($(this).css(&#8216;border-color&#8217;)) { colors.push($(this).css(&#8216;border-color&#8217;)); } }); //remove dupes and sort colors.sort(); //create a color block for all of them jQuery.each(colors,function(it,value) { if(!$(&#8216;div[rel=\'' + value + '\']&#8216;).length) { //inject the wrapper var wrapper_id = &#8216;w&#8217; + it; $(&#8216;<div class="dwrapper" id="' + wrapper_id + '" rel="' + value + '"> </div>&#8216;).appendTo(&#8216;#colors-wrapper&#8217;); //inject the color div $(&#8216;<div class="dcolor" style="background-color:' + value + '"> </div>&#8216;).appendTo(&#8216;#&#8217; + wrapper_id); //inject text div $(&#8216;<div class="text">&#8216; + value + &#8216;</div>&#8216;).appendTo(&#8216;#&#8217; + wrapper_id); } }); }); });   When someone clicks the &#8220;Get Colors&#8221; button, I grab every element in the DOM and collect its color, background-color, and border-color. Once I&#8217;ve cycled through all of the elements, cycle through all of the colors and display them as DIVs inside my colors-wrapper element. You&#8217;ll note that I utilized therel attribute to prevent duplicates.</a></h3><p>As I continue to learn jQuery, I think it's important that I begin by porting over scripts I've created using MooTools. One of those scripts ...</p></div></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.bageshsingh.com/bagesh-blog/2011/07/css-and-jquery-tutorial-fancy-apple-style-icon-slide-out-navigation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jPaginate: how to add a Fancy jQuery Pagination Plugin</title>
		<link>http://www.bageshsingh.com/bagesh-blog/2011/07/jpaginate-how-to-add-a-fancy-jquery-pagination-plugin/</link>
		<comments>http://www.bageshsingh.com/bagesh-blog/2011/07/jpaginate-how-to-add-a-fancy-jquery-pagination-plugin/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 18:44:44 +0000</pubDate>
		<dc:creator>Bagesh Singh</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[Interview Question]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://www.bageshsingh.com/bagesh-blog/?p=1397</guid>
		<description><![CDATA[jPaginate is a jQuery pagination plugin that comes with a twist: animated page numbers. The user can slide through the available page numbers by clicking or just hovering over the arrows. Shortlinks to the first and last page are available as well. You can call the plugin in the following way: &#160; $(elementID).paginate() You can [...]]]></description>
			<content:encoded><![CDATA[<p><img title="jPaginate" src="http://tympanus.net/codrops/wp-content/uploads/2009/11/jPaginate.png" alt="jPaginate" width="540" height="164" /></p>
<p>jPaginate is a jQuery pagination plugin that comes with a twist: animated page numbers. The user can slide through the available page numbers by clicking or just hovering over the arrows. Shortlinks to the first and last page are available as well.<br />
You can call the plugin in the following way:</p>
<p>&nbsp;</p>
<p><code>$(elementID).paginate()</code></p>
<p>You can configure the plugin with the following properties:</p>
<ol>
<li><strong>count</strong>: The total number of pages</li>
<li><strong>start</strong>: With which number the visible pages should start</li>
<li><strong>display</strong>: How many page numbers should be visible</li>
<li><strong>border</strong>: If there should be a border (true/false)</li>
<li><strong>border_color</strong>: Color of the border</li>
<li><strong>text_color</strong>: Color of the text/numbers</li>
<li><strong>background_color</strong>: Background color</li>
<li><strong>border_hover_color</strong>: Border color when hovering</li>
<li><strong>text_hover_color</strong>: Text color when hovering</li>
<li><strong>background_hover_color</strong>: Background color when hovering</li>
<li><strong>images</strong>: If the arrows should be images or not (true/false)</li>
<li><strong>mouse</strong>: With value “press” the user can keep the mouse button pressed and the page numbers will keep on sliding. With value “slide” the page numbers will slide once with each click.</li>
<li><strong>onChange</strong>: The callback function when clicking on a page. As argument the number of the page clicked can be used.</li>
</ol>
<p><a href="http://tympanus.net/jPaginate/jPaginate.zip">Download jPaginate</a></p>
<div></div>
<div id="seo_alrp_related"><h2>Posts Related to jPaginate: how to add a Fancy jQuery Pagination Plugin</h2><ul><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/how-to-add-beautiful-slide-out-navigation-a-css-and-jquery-tutorial/" rel="bookmark">how to add Beautiful Slide Out Navigation: A CSS and jQuery Tutorial</a></h3><p>1. The HTML Structure The only thing we will need for the navigation is a simple unordered list with links inside of the list elements: ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/twitter-api-and-jquery-showcase-display-your-followers-or-friends/" rel="bookmark">Twitter API and jQuery Showcase: Display your Followers or Friends</a></h3><p>Today I was playing around with the Twitter API and created this little “widget” using jQuery and PHP. I know, there are already plenty of ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/all-fixed-fade-out-menu-a-css-and-jquery-tutorial/" rel="bookmark">all Fixed Fade Out Menu: A CSS and jQuery Tutorial</a></h3><p>1. The HTML The markup is pretty simple: we have a div with a list inside. The list items will be our links, the search ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2010/11/color-palette-generator-using-jqueryas-i-continue-to-learn-jquery-i-think-its-important-that-i-begin-by-porting-over-scripts-ive-created-using-mootools-one-of-those-scripts-is-my-color-palette-g/" rel="bookmark">Color Palette Generator Using jQueryAs I continue to learn jQuery, I think it&#8217;s important that I begin by porting over scripts I&#8217;ve created using MooTools. One of those scripts is my Color Palette Generator script, which debuted on Eric Wendelin&#8217;s blog. For those of you that missed it, my script analyzes all of the colors on the page (minus images) and builds a palette of colors. Here it is in some jQuery goodness.  The XHTML  <input type="button" id="get-colors" value="Get Colors" class="button" /> <div id="colors-wrapper"></div>  All we need to begin with is the button that triggers the palette generation and a DIV container that will hold all of the DIVs my jQuery creates. The CSS  .dcolor { height:40px; } .dtext {  } .dwrapper { width:200px; float:left; padding:10px; margin:0 20px 20px 0; border:1px solid #ccc; }   These CSS classes act as containers for the text DIV I generate and the color-displaying DIV I generate. Those two DIVs are held in one wrapping DIV. The jQuery JavaScript  /* when the dom is ready */ $(document).ready(function() { $(&#8216;#get-colors&#8217;).click(function() {   //my colors array var colors = new Array(); //get all elements $(&#8216;*&#8217;).each(function() { if($(this).css(&#8216;background-color&#8217;) &#038;&#038; $(this).css(&#8216;background-color&#8217;) != &#8216;transparent&#8217;) { colors.push($(this).css(&#8216;background-color&#8217;)); } if($(this).css(&#8216;color&#8217;)) { colors.push($(this).css(&#8216;color&#8217;)); } if($(this).css(&#8216;border-color&#8217;)) { colors.push($(this).css(&#8216;border-color&#8217;)); } }); //remove dupes and sort colors.sort(); //create a color block for all of them jQuery.each(colors,function(it,value) { if(!$(&#8216;div[rel=\'' + value + '\']&#8216;).length) { //inject the wrapper var wrapper_id = &#8216;w&#8217; + it; $(&#8216;<div class="dwrapper" id="' + wrapper_id + '" rel="' + value + '"> </div>&#8216;).appendTo(&#8216;#colors-wrapper&#8217;); //inject the color div $(&#8216;<div class="dcolor" style="background-color:' + value + '"> </div>&#8216;).appendTo(&#8216;#&#8217; + wrapper_id); //inject text div $(&#8216;<div class="text">&#8216; + value + &#8216;</div>&#8216;).appendTo(&#8216;#&#8217; + wrapper_id); } }); }); });   When someone clicks the &#8220;Get Colors&#8221; button, I grab every element in the DOM and collect its color, background-color, and border-color. Once I&#8217;ve cycled through all of the elements, cycle through all of the colors and display them as DIVs inside my colors-wrapper element. You&#8217;ll note that I utilized therel attribute to prevent duplicates.</a></h3><p>As I continue to learn jQuery, I think it's important that I begin by porting over scripts I've created using MooTools. One of those scripts ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/02/change-background-color-of-gridview-cell-using-jquery/" rel="bookmark">Change Background Color of GridView Cell using jQuery</a></h3><p>Users often ask how to change the background color of an ASP.NET GridView cell, if the cell matches a condition. It’s actually quite simple using ...</p></div></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.bageshsingh.com/bagesh-blog/2011/07/jpaginate-how-to-add-a-fancy-jquery-pagination-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter API and jQuery Showcase: Display your Followers or Friends</title>
		<link>http://www.bageshsingh.com/bagesh-blog/2011/07/twitter-api-and-jquery-showcase-display-your-followers-or-friends/</link>
		<comments>http://www.bageshsingh.com/bagesh-blog/2011/07/twitter-api-and-jquery-showcase-display-your-followers-or-friends/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 18:43:24 +0000</pubDate>
		<dc:creator>Bagesh Singh</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[Home]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://www.bageshsingh.com/bagesh-blog/?p=1395</guid>
		<description><![CDATA[Today I was playing around with the Twitter API and created this little “widget” using jQuery and PHP. I know, there are already plenty of them, but I wanted to improve some details. Some of the features are: &#160; You can get your most recent 100 followers or friends Followers or friends are shown in [...]]]></description>
			<content:encoded><![CDATA[<p>Today I was playing around with the Twitter API and created this little “widget” using jQuery and PHP. I know, there are already plenty of them, but I wanted to improve some details.</p>
<p>Some of the features are:</p>
<p>&nbsp;</p>
<ul>
<li>You can get your most recent 100 followers or friends</li>
<li>Followers or friends are shown in sets of 25 per widget page</li>
<li>The images of the users are preloaded (unlike in Twitter)</li>
<li>You can navigate through the set</li>
<li>You can refresh the entire set</li>
<li>More information on the user can be seen using a tooltip when hovering over his picture</li>
</ul>
<p>You can configure and use this in your website to show your followers or friends with some interesting information about them (name, number of followers, number of friends).</p>
<p>A reason why 100 followers or friends are loaded in the beginning is the restriction the Twitter API is giving in the number of results per request. So, in order not to make several requests which would take quite some time, I just get 100. However, you can always click the link to the entire list in the end of the pagination.<a href="http://tympanus.net/TwitterConnections/TwitterConnections.zip">Download source</a></p>
<div id="seo_alrp_related"><h2>Posts Related to Twitter API and jQuery Showcase: Display your Followers or Friends</h2><ul><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2010/12/how-to-get-a-facebook-email-address-like-facebook-com/" rel="bookmark">How to Get a Facebook Email Address like @facebook.com?</a></h3><p>How to Get a Facebook Email Address like @facebook.com? Facebook as you know the top social networking site has recently introduced its own email service ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2010/10/digg-5-steps-to-become-social/" rel="bookmark">Digg &#8211; 5 Steps to Become Social</a></h3><p>First you have to make account on the Digg. This is zeroth step for digg because making profile and account doesn't matter on digg. The ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2010/04/facebook-chat-on-a-side-bar-of-mozilla/" rel="bookmark">Facebook Chat On a Side Bar Of Mozilla</a></h3><p>These days I am using Facebook a lot and no wonder everyone is using Facebook a lot. And the number of online users on Facebook ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2010/09/facebook-chat-on-a-side-bar-of-mozilla-2/" rel="bookmark">Facebook Chat On a Side Bar Of Mozilla</a></h3><p>These days I am using Facebook a lot and no wonder everyone is using Facebook a lot. And the number of online users on Facebook ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/jpaginate-how-to-add-a-fancy-jquery-pagination-plugin/" rel="bookmark">jPaginate: how to add a Fancy jQuery Pagination Plugin</a></h3><p>jPaginate is a jQuery pagination plugin that comes with a twist: animated page numbers. The user can slide through the available page numbers by clicking ...</p></div></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.bageshsingh.com/bagesh-blog/2011/07/twitter-api-and-jquery-showcase-display-your-followers-or-friends/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>all Fixed Fade Out Menu: A CSS and jQuery Tutorial</title>
		<link>http://www.bageshsingh.com/bagesh-blog/2011/07/all-fixed-fade-out-menu-a-css-and-jquery-tutorial/</link>
		<comments>http://www.bageshsingh.com/bagesh-blog/2011/07/all-fixed-fade-out-menu-a-css-and-jquery-tutorial/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 18:42:26 +0000</pubDate>
		<dc:creator>Bagesh Singh</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[Home]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[Interview Question]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://www.bageshsingh.com/bagesh-blog/?p=1393</guid>
		<description><![CDATA[1. The HTML The markup is pretty simple: we have a div with a list inside. The list items will be our links, the search input and the arrow buttons: 01 &#60;div id="nav"&#62; 02  &#60;ul&#62; 03   &#60;li&#62;&#60;a class="top" href="#top"&#62;&#60;span&#62;&#60;/span&#62;&#60;/a&#62;&#60;/li&#62; 04   &#60;li&#62;&#60;a class="bottom" href="#bottom"&#62;&#60;span&#62;&#60;/span&#62;&#60;/a&#62;&#60;/li&#62; 05   &#60;li&#62;&#60;a&#62;Link 1&#60;/a&#62;&#60;/li&#62; 06   &#60;li&#62;&#60;a&#62;Link 2&#60;/a&#62;&#60;/li&#62; 07   &#60;li&#62;&#60;a&#62;Link 3&#60;/a&#62;&#60;/li&#62; 08   &#60;li&#62;&#60;a&#62;Link 4&#60;/a&#62;&#60;/li&#62; [...]]]></description>
			<content:encoded><![CDATA[<h3>1. The HTML</h3>
<p>The markup is pretty simple: we have a div with a list inside. The list items will be our links, the search input and the arrow buttons:</p>
<div id="highlighter_878989">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>&lt;</code><code>div</code> <code>id</code><code>=</code><code>"nav"</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code> </code><code>&lt;</code><code>ul</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>  </code><code>&lt;</code><code>li</code><code>&gt;&lt;</code><code>a</code> <code>class</code><code>=</code><code>"top"</code> <code>href</code><code>=</code><code>"#top"</code><code>&gt;&lt;</code><code>span</code><code>&gt;&lt;/</code><code>span</code><code>&gt;&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>  </code><code>&lt;</code><code>li</code><code>&gt;&lt;</code><code>a</code> <code>class</code><code>=</code><code>"bottom"</code> <code>href</code><code>=</code><code>"#bottom"</code><code>&gt;&lt;</code><code>span</code><code>&gt;&lt;/</code><code>span</code><code>&gt;&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>  </code><code>&lt;</code><code>li</code><code>&gt;&lt;</code><code>a</code><code>&gt;Link 1&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>  </code><code>&lt;</code><code>li</code><code>&gt;&lt;</code><code>a</code><code>&gt;Link 2&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>  </code><code>&lt;</code><code>li</code><code>&gt;&lt;</code><code>a</code><code>&gt;Link 3&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>  </code><code>&lt;</code><code>li</code><code>&gt;&lt;</code><code>a</code><code>&gt;Link 4&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>  </code><code>&lt;</code><code>li</code><code>&gt;&lt;</code><code>a</code><code>&gt;Link 5&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>  </code><code>&lt;</code><code>li</code><code>&gt;&lt;</code><code>a</code><code>&gt;Link 6&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>  </code><code>&lt;</code><code>li</code> <code>class</code><code>=</code><code>"search"</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>   </code><code>&lt;</code><code>input</code> <code>type</code><code>=</code><code>"text"</code><code>/&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>   </code><code>&lt;</code><code>input</code> <code>class</code><code>=</code><code>"searchbutton"</code> <code>type</code><code>=</code><code>"submit"</code> <code>value</code><code>=</code><code>""</code><code>/&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>  </code><code>&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code> </code><code>&lt;/</code><code>ul</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>&lt;/</code><code>div</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The links with the classes <strong>top </strong>and <strong>bottom </strong>are the arrows that will lead the user to the beginning or the end of the page. The hrefs in these links reference to some elements having the id top and bottom. <strong>Make sure, you reference the right elements in your page</strong>. The bottom could, for example, be your comments section in you WordPress blog. In that case you would need to refer to #comments instead.</p>
<p>The span of the top and bottom links will contain the actual arrows as background images.<br />
The search button which is a <strong>submit button will have no value</strong> since we want to give it a background image and no text.</p>
<p>Let’s look at the style now.</p>
<h3>2. The CSS</h3>
<p>Let’s first define the main navigation div:</p>
<div id="highlighter_806195">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>#nav{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>height</code><code>:</code><code>35px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>border-bottom</code><code>:</code><code>1px</code> <code>solid</code> <code>#ddd</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>position</code><code>:</code><code>fixed</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>top</code><code>:</code><code>0px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>    </code><code>left</code><code>:</code><code>0px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>right</code><code>:</code><code>0px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>background</code><code>:</code><code>#fff</code> <code>url</code><code>(../images/nav.png) </code><code>repeat-x</code> <code>center</code> <code>left</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>    </code><code>z-index</code><code>:</code><code>999999</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The navigation will always stay right at the top of the page because we “glue” it there with <strong>position:fixed and top:0px</strong>. The background image will be a semi-transparent button-like background with a slight 3D effect. Since it is almost transparent, you can try to use different background colors instead of white (#ffffff).</p>
<p>We set the z-index very high since we don’t want any other absolute element to be on top of our navigation.</p>
<p>The unordered list and its list items will have the following style:</p>
<div id="highlighter_372868">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>#nav ul{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>height</code><code>:</code><code>25px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>list-style</code><code>:</code><code>none</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>margin</code><code>:</code><code>6px</code> <code>auto</code> <code>0px</code> <code>auto</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>width</code><code>:</code><code>600px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>#nav ul li{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>display</code><code>:</code><code>inline</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>    </code><code>float</code><code>:</code><code>left</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>    </code><code>margin</code><code>:</code><code>0px</code> <code>2px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The unordered list has a fixed width of 600px and will be positioned in the center of the navigation. <strong>Centering a relatively positioned element can be achieved by stating that the left and right margin is auto</strong>.</p>
<p>The list elements shall be aligned next to each other. We define that with <strong>display:inline</strong>. We make them floating left because we want to apply a margin here, creating some space between the items.</p>
<p>The general style of all the link elements will be the following:</p>
<div id="highlighter_60062">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>#nav a{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>font-size</code><code>:</code><code>11px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>font-weight</code><code>:</code><code>bold</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>float</code><code>:</code><code>left</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>padding</code><code>: </code><code>2px</code> <code>4px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>    </code><code>color</code><code>:</code><code>#999</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>text-decoration</code><code>: </code><code>none</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>border</code><code>:</code><code>1px</code> <code>solid</code> <code>#ccc</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>    </code><code>cursor</code><code>: </code><code>pointer</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>    </code><code>background</code><code>:</code><code>transparent</code> <code>url</code><code>(../images/overlay.png) </code><code>repeat-x</code> <code>center</code> <code>left</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>    </code><code>height</code><code>:</code><code>16px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>    </code><code>line-height</code><code>:</code><code>16px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>#nav a:hover{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>    </code><code>background</code><code>:</code><code>#D9D9DA</code> <code>none</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>    </code><code>color</code><code>: </code><code>#fff</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>17</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>Although it is not really necessary to state that the cursor should be of type pointer here since it is a link element, I often define that because <strong>in some browsers the pointer will only appear when there is an “href”</strong>. That might not always be the case and so it is always better to define it again in the CSS if one is not sure how link elements will be used.</p>
<p>The links will have a semi-transparent background image similar to the one for the navigation. Again, you can simply define a color for the background or experiment with combinations of these. The overlay image tints any background color in a light gray.</p>
<p>When hovering over the link element, we remove the background image and change the background color.</p>
<p>Let’s look at the style of the two arrow links:</p>
<div id="highlighter_852721">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>#nav a.</code><code>top</code> <code>span, #nav a.</code><code>bottom</code> <code>span{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>float</code><code>:</code><code>left</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>width</code><code>:</code><code>16px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>height</code><code>:</code><code>16px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>#nav a.</code><code>top</code> <code>span{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>background</code><code>:</code><code>transparent</code> <code>url</code><code>(../images/</code><code>top</code><code>.png) </code><code>no-repeat</code> <code>center</code> <code>center</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>#nav a.</code><code>bottom</code> <code>span{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>    </code><code>background</code><code>:</code><code>transparent</code> <code>url</code><code>(../images/</code><code>bottom</code><code>.png) </code><code>no-repeat</code> <code>center</code> <code>center</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>Now we define the style for the list element that contains the search and the text input:</p>
<div id="highlighter_179855">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>#nav ul li.search{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>    </code><code>float</code><code>:</code><code>right</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>#nav input[type=</code><code>"text"</code><code>]{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code>    </code><code>float</code><code>:</code><code>left</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>6</code></td>
<td><code>    </code><code>border</code><code>:</code><code>1px</code> <code>solid</code> <code>#ccc</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>7</code></td>
<td><code>    </code><code>margin</code><code>:</code><code>0px</code> <code>1px</code> <code>0px</code> <code>50px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>8</code></td>
<td><code>    </code><code>padding</code><code>:</code><code>2px</code> <code>2px</code> <code>2px</code> <code>2px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>9</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>Generally, with specifying <strong>input[type="text"]</strong> you make sure that you will not change the style of all other inputs. That is a good way of specifying the design of a certain type of inputs.<br />
The margin (TOP RIGHT BOTTOM LEFT) to the left will be a bit more because we want to separate the other links from the search.</p>
<p>The submit button will have the following style:</p>
<div id="highlighter_624857">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>input.searchbutton{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>border</code><code>:</code><code>1px</code> <code>solid</code> <code>#ccc</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>padding</code><code>:</code><code>1px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>cursor</code><code>:</code><code>pointer</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>width</code><code>:</code><code>30px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>    </code><code>height</code><code>:</code><code>22px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>background</code><code>:</code><code>#E8E9EA</code> <code>url</code><code>(../images/search.png) </code><code>no-repeat</code> <code>center</code> <code>center</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>input.searchbutton:hover{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>    </code><code>background-color</code><code>:</code><code>#D9D9DA</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>This is a good example of when to use a class instead of specifying the style for e.g. input[type="submit"]. There might be many submits in your page, but this one is very special and no other submit will look like it except the search submit.<br />
This input will not have any value as you saw in the HTML part. Instead, we will have an icon as background image.</p>
<p>And that’s all the style! Now let’s add some rocking JavaScript:</p>
<h3>3. The JavaScript</h3>
<p>What we want to do now, is to leave the menu as it is, whenever we are at the top of the page. When we start scrolling, we want the menu to fade out and to be almost transparent. When we hover over it, it should appear opaque again. All this we define in the following lines of JavaScript:</p>
<div id="highlighter_314641">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>$(</code><code>function</code><code>() {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>$(window).scroll(</code><code>function</code><code>(){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>        </code><code>var</code> <code>scrollTop = $(window).scrollTop();</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>        </code><code>if</code><code>(scrollTop != 0)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>            </code><code>$(</code><code>'#nav'</code><code>).stop().animate({</code><code>'opacity'</code><code>:</code><code>'0.2'</code><code>},400);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>        </code><code>else</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>            </code><code>$(</code><code>'#nav'</code><code>).stop().animate({</code><code>'opacity'</code><code>:</code><code>'1'</code><code>},400);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>});</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>    </code><code>$(</code><code>'#nav'</code><code>).hover(</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>        </code><code>function</code> <code>(e) {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>            </code><code>var</code> <code>scrollTop = $(window).scrollTop();</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>            </code><code>if</code><code>(scrollTop != 0){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>                </code><code>$(</code><code>'#nav'</code><code>).stop().animate({</code><code>'opacity'</code><code>:</code><code>'1'</code><code>},400);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>            </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>        </code><code>},</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>17</code></td>
<td><code>        </code><code>function</code> <code>(e) {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>18</code></td>
<td><code>            </code><code>var</code> <code>scrollTop = $(window).scrollTop();</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>19</code></td>
<td><code>            </code><code>if</code><code>(scrollTop != 0){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>20</code></td>
<td><code>                </code><code>$(</code><code>'#nav'</code><code>).stop().animate({</code><code>'opacity'</code><code>:</code><code>'0.2'</code><code>},400);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>21</code></td>
<td><code>            </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>22</code></td>
<td><code>        </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>23</code></td>
<td><code>    </code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>24</code></td>
<td><code>});</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>So, if we are not at the top of the page, scrolling the window will change the opacity value. That effect takes 400 milliseconds (adapt to your preferred time). If we are at the top of the page, the opacity will have the value 1 which means that the element will be opaque.</p>
<p>When hovering over the element, we make it opaque and when we move the mouse out, we will make it more transparent again (if we are not at the top).</p>
<p>And that’s all! Enjoy!</p>
<div id="seo_alrp_related"><h2>Posts Related to all Fixed Fade Out Menu: A CSS and jQuery Tutorial</h2><ul><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/css-and-jquery-tutorial-fancy-apple-style-icon-slide-out-navigation/" rel="bookmark">CSS and jQuery Tutorial: Fancy Apple-Style Icon Slide Out Navigation</a></h3><p>1. The HTML The markup just consists of a div with an unordered list inside. The list elements contain a span for the icon and ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/how-to-add-beautiful-slide-out-navigation-a-css-and-jquery-tutorial/" rel="bookmark">how to add Beautiful Slide Out Navigation: A CSS and jQuery Tutorial</a></h3><p>1. The HTML Structure The only thing we will need for the navigation is a simple unordered list with links inside of the list elements: ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2010/11/sleek-and-smooth-animated-menu-jquery/" rel="bookmark">Sleek and Smooth animated menu using jQuery</a></h3><p>Today, I’m going to show you something interesting with jQuery. Yesterday I was thinking something to post something programming related stuff  in blog after long ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/how-to-add-sweet-thumbnails-preview-gallery/" rel="bookmark">how to add Sweet Thumbnails Preview Gallery</a></h3><p>The Markup The HTML structure is going to consist of a main container which will have the image wrapper for the big image, the navigation ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2010/11/color-palette-generator-using-jqueryas-i-continue-to-learn-jquery-i-think-its-important-that-i-begin-by-porting-over-scripts-ive-created-using-mootools-one-of-those-scripts-is-my-color-palette-g/" rel="bookmark">Color Palette Generator Using jQueryAs I continue to learn jQuery, I think it&#8217;s important that I begin by porting over scripts I&#8217;ve created using MooTools. One of those scripts is my Color Palette Generator script, which debuted on Eric Wendelin&#8217;s blog. For those of you that missed it, my script analyzes all of the colors on the page (minus images) and builds a palette of colors. Here it is in some jQuery goodness.  The XHTML  <input type="button" id="get-colors" value="Get Colors" class="button" /> <div id="colors-wrapper"></div>  All we need to begin with is the button that triggers the palette generation and a DIV container that will hold all of the DIVs my jQuery creates. The CSS  .dcolor { height:40px; } .dtext {  } .dwrapper { width:200px; float:left; padding:10px; margin:0 20px 20px 0; border:1px solid #ccc; }   These CSS classes act as containers for the text DIV I generate and the color-displaying DIV I generate. Those two DIVs are held in one wrapping DIV. The jQuery JavaScript  /* when the dom is ready */ $(document).ready(function() { $(&#8216;#get-colors&#8217;).click(function() {   //my colors array var colors = new Array(); //get all elements $(&#8216;*&#8217;).each(function() { if($(this).css(&#8216;background-color&#8217;) &#038;&#038; $(this).css(&#8216;background-color&#8217;) != &#8216;transparent&#8217;) { colors.push($(this).css(&#8216;background-color&#8217;)); } if($(this).css(&#8216;color&#8217;)) { colors.push($(this).css(&#8216;color&#8217;)); } if($(this).css(&#8216;border-color&#8217;)) { colors.push($(this).css(&#8216;border-color&#8217;)); } }); //remove dupes and sort colors.sort(); //create a color block for all of them jQuery.each(colors,function(it,value) { if(!$(&#8216;div[rel=\'' + value + '\']&#8216;).length) { //inject the wrapper var wrapper_id = &#8216;w&#8217; + it; $(&#8216;<div class="dwrapper" id="' + wrapper_id + '" rel="' + value + '"> </div>&#8216;).appendTo(&#8216;#colors-wrapper&#8217;); //inject the color div $(&#8216;<div class="dcolor" style="background-color:' + value + '"> </div>&#8216;).appendTo(&#8216;#&#8217; + wrapper_id); //inject text div $(&#8216;<div class="text">&#8216; + value + &#8216;</div>&#8216;).appendTo(&#8216;#&#8217; + wrapper_id); } }); }); });   When someone clicks the &#8220;Get Colors&#8221; button, I grab every element in the DOM and collect its color, background-color, and border-color. Once I&#8217;ve cycled through all of the elements, cycle through all of the colors and display them as DIVs inside my colors-wrapper element. You&#8217;ll note that I utilized therel attribute to prevent duplicates.</a></h3><p>As I continue to learn jQuery, I think it's important that I begin by porting over scripts I've created using MooTools. One of those scripts ...</p></div></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.bageshsingh.com/bagesh-blog/2011/07/all-fixed-fade-out-menu-a-css-and-jquery-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>how to add Beautiful Slide Out Navigation: A CSS and jQuery Tutorial</title>
		<link>http://www.bageshsingh.com/bagesh-blog/2011/07/how-to-add-beautiful-slide-out-navigation-a-css-and-jquery-tutorial/</link>
		<comments>http://www.bageshsingh.com/bagesh-blog/2011/07/how-to-add-beautiful-slide-out-navigation-a-css-and-jquery-tutorial/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 18:41:29 +0000</pubDate>
		<dc:creator>Bagesh Singh</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[Home]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[Interview Question]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://www.bageshsingh.com/bagesh-blog/?p=1391</guid>
		<description><![CDATA[1. The HTML Structure The only thing we will need for the navigation is a simple unordered list with links inside of the list elements: 1 &#60;ul id="navigation"&#62; 2  &#60;li class="home"&#62;&#60;a title="Home"&#62;&#60;/a&#62;&#60;/li&#62; 3  &#60;li class="about"&#62;&#60;a title="About"&#62;&#60;/a&#62;&#60;/li&#62; 4  &#60;li class="search"&#62;&#60;a title="Search"&#62;&#60;/a&#62;&#60;/li&#62; 5  &#60;li class="photos"&#62;&#60;a title="Photos"&#62;&#60;/a&#62;&#60;/li&#62; 6  &#60;li class="rssfeed"&#62;&#60;a title="Rss Feed"&#62;&#60;/a&#62;&#60;/li&#62; 7  &#60;li class="podcasts"&#62;&#60;a title="Podcasts"&#62;&#60;/a&#62;&#60;/li&#62; 8  &#60;li [...]]]></description>
			<content:encoded><![CDATA[<h3>1. The HTML Structure</h3>
<p>The only thing we will need for the navigation is a simple unordered list with links inside of the list elements:</p>
<div id="highlighter_498339">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>&lt;</code><code>ul</code> <code>id</code><code>=</code><code>"navigation"</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code> </code><code>&lt;</code><code>li</code> <code>class</code><code>=</code><code>"home"</code><code>&gt;&lt;</code><code>a</code> <code>title</code><code>=</code><code>"Home"</code><code>&gt;&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code> </code><code>&lt;</code><code>li</code> <code>class</code><code>=</code><code>"about"</code><code>&gt;&lt;</code><code>a</code> <code>title</code><code>=</code><code>"About"</code><code>&gt;&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code> </code><code>&lt;</code><code>li</code> <code>class</code><code>=</code><code>"search"</code><code>&gt;&lt;</code><code>a</code> <code>title</code><code>=</code><code>"Search"</code><code>&gt;&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code> </code><code>&lt;</code><code>li</code> <code>class</code><code>=</code><code>"photos"</code><code>&gt;&lt;</code><code>a</code> <code>title</code><code>=</code><code>"Photos"</code><code>&gt;&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>6</code></td>
<td><code> </code><code>&lt;</code><code>li</code> <code>class</code><code>=</code><code>"rssfeed"</code><code>&gt;&lt;</code><code>a</code> <code>title</code><code>=</code><code>"Rss Feed"</code><code>&gt;&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>7</code></td>
<td><code> </code><code>&lt;</code><code>li</code> <code>class</code><code>=</code><code>"podcasts"</code><code>&gt;&lt;</code><code>a</code> <code>title</code><code>=</code><code>"Podcasts"</code><code>&gt;&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>8</code></td>
<td><code> </code><code>&lt;</code><code>li</code> <code>class</code><code>=</code><code>"contact"</code><code>&gt;&lt;</code><code>a</code> <code>title</code><code>=</code><code>"Contact"</code><code>&gt;&lt;/</code><code>a</code><code>&gt;&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>9</code></td>
<td><code>&lt;/</code><code>ul</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The list is getting an ID because we want to refer to it later in the JavaScript. With jQuery, we will make the link items slide out whenever we hover over the li elements of the list.</p>
<h3>2. The CSS</h3>
<p>First, we define the CSS properties for the list:</p>
<div id="highlighter_631718">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ul#navigation {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>    </code><code>position</code><code>: </code><code>fixed</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>    </code><code>margin</code><code>: </code><code>0px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>    </code><code>padding</code><code>: </code><code>0px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code>    </code><code>top</code><code>: </code><code>10px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>6</code></td>
<td><code>    </code><code>left</code><code>: </code><code>0px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>7</code></td>
<td><code>    </code><code>list-style</code><code>: </code><code>none</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>8</code></td>
<td><code>    </code><code>z-index</code><code>:</code><code>9999</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>9</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The navigation should always be accessible for the user, even if he scrolls down the page. So, the position should be fixed. Margin and padding are explicitly set to 0, since the unordered list has default values for them. The navigation should also be on top of all other elements on the page. That’s why we set the z-index very high.</p>
<p>Now, let’s look at the list element properties:</p>
<div id="highlighter_375457">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ul#navigation li {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>    </code><code>width</code><code>: </code><code>100px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>For the links in the list elements, we define the following CSS properties:</p>
<div id="highlighter_413266">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>ul#navigation li a {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>display</code><code>: </code><code>block</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>margin-left</code><code>: </code><code>-85px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>width</code><code>: </code><code>100px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>height</code><code>: </code><code>70px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>    </code><code>background-color</code><code>:</code><code>#CFCFCF</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>background-repeat</code><code>:</code><code>no-repeat</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>background-position</code><code>:</code><code>center</code> <code>center</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>    </code><code>border</code><code>:</code><code>1px</code> <code>solid</code> <code>#AFAFAF</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The margin-left is set to a negative value because we want to hide most of the icon and only reveal it when we hover over the list items. Basically, we are pushing the link element to the left, outside of the visual area of the page:</p>
<p><img title="slideoututorial1" src="http://tympanus.net/codrops/wp-content/uploads/2009/11/slideoututorial11.png" alt="slideoututorial1" width="379" height="248" /></p>
<p>In the JavaScript part we will define a function that makes the elements slide out. But let’s first add some rounded borders to them (they don’t work in Internet Explorer, though):</p>
<div id="highlighter_817222">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>ul#navigation li a {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>display</code><code>: </code><code>block</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>margin-left</code><code>: </code><code>-85px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>width</code><code>: </code><code>100px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>height</code><code>: </code><code>70px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>    </code><code>background-color</code><code>:</code><code>#CFCFCF</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>background-repeat</code><code>:</code><code>no-repeat</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>background-position</code><code>:</code><code>center</code> <code>center</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>    </code><code>border</code><code>:</code><code>1px</code> <code>solid</code> <code>#AFAFAF</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>    </code><code>-moz-border-radius:</code><code>0px</code> <code>10px</code> <code>10px</code> <code>0px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>    </code><code>-webkit-border-bottom-right-radius: </code><code>10px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>    </code><code>-webkit-border-top-right-radius: </code><code>10px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>    </code><code>-khtml-border-bottom-right-radius: </code><code>10px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>    </code><code>-khtml-border-top-right-radius: </code><code>10px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>To make them really neat, we add some opacity, so that the content underneath is visible:</p>
<div id="highlighter_802253">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>ul#navigation li a {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>display</code><code>: </code><code>block</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>margin-left</code><code>: </code><code>-85px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>width</code><code>: </code><code>100px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>height</code><code>: </code><code>70px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>    </code><code>background-color</code><code>:</code><code>#CFCFCF</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>background-repeat</code><code>:</code><code>no-repeat</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>background-position</code><code>:</code><code>center</code> <code>center</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>    </code><code>border</code><code>:</code><code>1px</code> <code>solid</code> <code>#AFAFAF</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>    </code><code>-moz-border-radius:</code><code>0px</code> <code>10px</code> <code>10px</code> <code>0px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>    </code><code>-webkit-border-bottom-right-radius: </code><code>10px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>    </code><code>-webkit-border-top-right-radius: </code><code>10px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>    </code><code>-khtml-border-bottom-right-radius: </code><code>10px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>    </code><code>-khtml-border-top-right-radius: </code><code>10px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>    </code><code>opacity</code><code>: </code><code>0.6</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>    </code><code>filter:progid:DXImageTransform.Microsoft.Alpha(opacity=</code><code>60</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>17</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The last filter property will make this work for Internet Explorer as well.<br />
These were the common properties of all the link elements in the list. Now we will define the background image for the links in the specific list items:</p>
<div id="highlighter_618867">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>ul#navigation .home a{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>background-image</code><code>: </code><code>url</code><code>(../images/home.png);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>ul#navigation .about a      {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>background-image</code><code>: </code><code>url</code><code>(../images/id_card.png);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>ul#navigation .search a      {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>background-image</code><code>: </code><code>url</code><code>(../images/search.png);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>ul#navigation .podcasts a      {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>    </code><code>background-image</code><code>: </code><code>url</code><code>(../images/ipod.png);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>ul#navigation .rssfeed a   {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>    </code><code>background-image</code><code>: </code><code>url</code><code>(../images/rss.png);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>ul#navigation .photos a     {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>17</code></td>
<td><code>    </code><code>background-image</code><code>: </code><code>url</code><code>(../images/camera.png);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>18</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>19</code></td>
<td><code>ul#navigation .contact a    {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>20</code></td>
<td><code>    </code><code>background-image</code><code>: </code><code>url</code><code>(../images/mail.png);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>21</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>And that was the CSS part. Now, let’s take a look at the few lines of JavaScript that will give some life to the navigation.</p>
<h3>The JavaScript</h3>
<p>Using jQuery, we will make the icons appear whenever we hover over one of the list items. Remember, the list item itself is 100 pixel wide, only the link element is being pushed outside of the page to the left, so that it is not visible.</p>
<p>We define the following function (before the end of the body tag) that get’s executed whenever we hover over a li:</p>
<div id="highlighter_286111">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>$(</code><code>function</code><code>() {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code> </code><code>$(</code><code>'#navigation &gt; li'</code><code>).hover(</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>  </code><code>function</code> <code>() {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>   </code><code>$(</code><code>'a'</code><code>,$(</code><code>this</code><code>)).stop().animate({</code><code>'marginLeft'</code><code>:</code><code>'-2px'</code><code>},200);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>  </code><code>},</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>  </code><code>function</code> <code>() {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>   </code><code>$(</code><code>'a'</code><code>,$(</code><code>this</code><code>)).stop().animate({</code><code>'marginLeft'</code><code>:</code><code>'-85px'</code><code>},200);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>  </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code> </code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>});</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>So, when hovering, we want the specific link element to get a left margin of -2 pixels, and that nicely animated, and not too slow (200 milliseconds). Moving the mouse out shall put the link element back to it’s old position (-85 pixels). The stop() function “stops all the currently running animations on all the specified elements” which gives the beautiful effect when, for example, hovering over all elements very quickly.</p>
<p>What would be really nice now, is to make the user aware that there is such an amazing navigation on your web page. Like it is now, the user will merely see some grey borders sticking out from the left side of the page. What could be better for showing the menu than actually showing the navigation shortly when the page loads. So, here we go.</p>
<p>So, we will initially let the navigation be visible. For that we change the left margin of the link elements:</p>
<div id="highlighter_129172">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>ul#navigation li a {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>display</code><code>: </code><code>block</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>margin-left</code><code>: </code><code>-2px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>width</code><code>: </code><code>100px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>height</code><code>: </code><code>70px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>    </code><code>background-color</code><code>:</code><code>#CFCFCF</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>background-repeat</code><code>:</code><code>no-repeat</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>background-position</code><code>:</code><code>center</code> <code>center</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>    </code><code>border</code><code>:</code><code>1px</code> <code>solid</code> <code>#AFAFAF</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>    </code><code>-moz-border-radius:</code><code>0px</code> <code>10px</code> <code>10px</code> <code>0px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>    </code><code>-webkit-border-bottom-right-radius: </code><code>10px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>    </code><code>-webkit-border-top-right-radius: </code><code>10px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>    </code><code>-khtml-border-bottom-right-radius: </code><code>10px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>    </code><code>-khtml-border-top-right-radius: </code><code>10px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>    </code><code>opacity</code><code>: </code><code>0.6</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>    </code><code>filter:progid:DXImageTransform.Microsoft.Alpha(opacity=</code><code>60</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>17</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>And we add the following line at the beginning of the JavaScript function:</p>
<div id="highlighter_617331">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>$(</code><code>function</code><code>() {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code> </code><code>$(</code><code>'#navigation a'</code><code>).stop().animate({</code><code>'marginLeft'</code><code>:</code><code>'-85px'</code><code>},1000);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code> </code><code>$(</code><code>'#navigation &gt; li'</code><code>).hover(</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>  </code><code>function</code> <code>() {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>   </code><code>$(</code><code>'a'</code><code>,$(</code><code>this</code><code>)).stop().animate({</code><code>'marginLeft'</code><code>:</code><code>'-2px'</code><code>},200);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>  </code><code>},</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>  </code><code>function</code> <code>() {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>   </code><code>$(</code><code>'a'</code><code>,$(</code><code>this</code><code>)).stop().animate({</code><code>'marginLeft'</code><code>:</code><code>'-85px'</code><code>},200);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>  </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code> </code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>});</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>With that line we defined that it should take 1 second to give a left margin of -85 pixels to all the link elements in the list. Through the margin that we set we will show the navigation to the user and with the JavaScript we will then hide it.</p>
<p>And that’s it!</p>
<p>If you are a shadow-freak (like me), you can also add these lines to the CSS of the link element:</p>
<div id="highlighter_611849">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>ul#navigation li a {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>display</code><code>: </code><code>block</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>margin-left</code><code>: </code><code>-2px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>width</code><code>: </code><code>100px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>height</code><code>: </code><code>70px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>    </code><code>background-color</code><code>:</code><code>#CFCFCF</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>background-repeat</code><code>:</code><code>no-repeat</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>background-position</code><code>:</code><code>center</code> <code>center</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>    </code><code>border</code><code>:</code><code>1px</code> <code>solid</code> <code>#AFAFAF</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>    </code><code>-moz-border-radius:</code><code>0px</code> <code>10px</code> <code>10px</code> <code>0px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>    </code><code>-webkit-border-bottom-right-radius: </code><code>10px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>    </code><code>-webkit-border-top-right-radius: </code><code>10px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>    </code><code>-khtml-border-bottom-right-radius: </code><code>10px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>    </code><code>-khtml-border-top-right-radius: </code><code>10px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>    </code><code>-moz-</code><code>box-shadow</code><code>: </code><code>0px</code> <code>4px</code> <code>3px</code> <code>#000</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>    </code><code>-webkit-</code><code>box-shadow</code><code>: </code><code>0px</code> <code>4px</code> <code>3px</code> <code>#000</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>17</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>Adding the box shadow and removing opacity, will give the navigation items a 3D look. Leaving the opacity makes them look cool, too, try it out and enjoy!</p>
<div id="seo_alrp_related"><h2>Posts Related to how to add Beautiful Slide Out Navigation: A CSS and jQuery Tutorial</h2><ul><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/all-fixed-fade-out-menu-a-css-and-jquery-tutorial/" rel="bookmark">all Fixed Fade Out Menu: A CSS and jQuery Tutorial</a></h3><p>1. The HTML The markup is pretty simple: we have a div with a list inside. The list items will be our links, the search ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/css-and-jquery-tutorial-fancy-apple-style-icon-slide-out-navigation/" rel="bookmark">CSS and jQuery Tutorial: Fancy Apple-Style Icon Slide Out Navigation</a></h3><p>1. The HTML The markup just consists of a div with an unordered list inside. The list elements contain a span for the icon and ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/how-to-add-sweet-thumbnails-preview-gallery/" rel="bookmark">how to add Sweet Thumbnails Preview Gallery</a></h3><p>The Markup The HTML structure is going to consist of a main container which will have the image wrapper for the big image, the navigation ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2010/11/sleek-and-smooth-animated-menu-jquery/" rel="bookmark">Sleek and Smooth animated menu using jQuery</a></h3><p>Today, I’m going to show you something interesting with jQuery. Yesterday I was thinking something to post something programming related stuff  in blog after long ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/02/jquery-1-4-4-fadetoggle-function/" rel="bookmark">jQuery 1.4.4 fadeToggle() function</a></h3><p>So far, we have been using the slideToggle() and toggleClass() functions. The new jQuery 1.4.4 now introduces the fadeToggle() function. fadeToggle() provides built in toggle ...</p></div></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.bageshsingh.com/bagesh-blog/2011/07/how-to-add-beautiful-slide-out-navigation-a-css-and-jquery-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>how to add Sweet Thumbnails Preview Gallery</title>
		<link>http://www.bageshsingh.com/bagesh-blog/2011/07/how-to-add-sweet-thumbnails-preview-gallery/</link>
		<comments>http://www.bageshsingh.com/bagesh-blog/2011/07/how-to-add-sweet-thumbnails-preview-gallery/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 18:40:14 +0000</pubDate>
		<dc:creator>Bagesh Singh</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Home]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[Interview Question]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://www.bageshsingh.com/bagesh-blog/?p=1389</guid>
		<description><![CDATA[The Markup The HTML structure is going to consist of a main container which will have the image wrapper for the big image, the navigation items and the dot list with the thumbnail preview: 01 &#60;div id="ps_container" class="ps_container"&#62; 02     &#60;div class="ps_image_wrapper"&#62; 03         &#60;!-- First initial image --&#62; 04         &#60;img src="images/1.jpg" alt="" /&#62; 05     &#60;/div&#62; 06 [...]]]></description>
			<content:encoded><![CDATA[<h3>The Markup</h3>
<p>The HTML structure is going to consist of a main container which will have the image wrapper for the big image, the navigation items and the dot list with the thumbnail preview:</p>
<div id="highlighter_348687">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>&lt;</code><code>div</code> <code>id</code><code>=</code><code>"ps_container"</code> <code>class</code><code>=</code><code>"ps_container"</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>&lt;</code><code>div</code> <code>class</code><code>=</code><code>"ps_image_wrapper"</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>        </code><code>&lt;!-- First initial image --&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>        </code><code>&lt;</code><code>img</code> <code>src</code><code>=</code><code>"images/1.jpg"</code> <code>alt</code><code>=</code><code>""</code> <code>/&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>&lt;/</code><code>div</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>    </code><code>&lt;!-- Navigation items --&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>&lt;</code><code>div</code> <code>class</code><code>=</code><code>"ps_next"</code><code>&gt;&lt;/</code><code>div</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>&lt;</code><code>div</code> <code>class</code><code>=</code><code>"ps_prev"</code><code>&gt;&lt;/</code><code>div</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>    </code><code>&lt;!-- Dot list with thumbnail preview --&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>    </code><code>&lt;</code><code>ul</code> <code>class</code><code>=</code><code>"ps_nav"</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>        </code><code>&lt;</code><code>li</code> <code>class</code><code>=</code><code>"selected"</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>            </code><code>&lt;</code><code>a</code> <code>href</code><code>=</code><code>"images/1.jpg"</code> <code>rel</code><code>=</code><code>"images/thumbs/1.jpg"</code><code>&gt;Image 1&lt;/</code><code>a</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>        </code><code>&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>        </code><code>&lt;</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>            </code><code>&lt;</code><code>a</code> <code>href</code><code>=</code><code>"images/2.jpg"</code> <code>rel</code><code>=</code><code>"images/thumbs/2.jpg"</code><code>&gt;Image 2&lt;/</code><code>a</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>        </code><code>&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>17</code></td>
<td><code>        </code><code>...</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>18</code></td>
<td><code>        </code><code>&lt;</code><code>li</code> <code>class</code><code>=</code><code>"ps_preview"</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>19</code></td>
<td><code>            </code><code>&lt;</code><code>div</code> <code>class</code><code>=</code><code>"ps_preview_wrapper"</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>20</code></td>
<td><code>                </code><code>&lt;!-- Thumbnail comes here --&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>21</code></td>
<td><code>            </code><code>&lt;/</code><code>div</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>22</code></td>
<td><code>            </code><code>&lt;!-- Little triangle --&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>23</code></td>
<td><code>            </code><code>&lt;</code><code>span</code><code>&gt;&lt;/</code><code>span</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>24</code></td>
<td><code>        </code><code>&lt;/</code><code>li</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>25</code></td>
<td><code>    </code><code>&lt;/</code><code>ul</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>26</code></td>
<td><code>&lt;/</code><code>div</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The thumbnail preview element will be a list item in the dot list. It’s going to have a special class since we want to treat this element differently. Each dot list item will contain a link element which will hold the information on the thumbnail image and the big image. Using JavaScript, we will extract that path information from the attributes and create the image elements dynamically.</p>
<p>Let’s take a look at the style.</p>
<h3>The CSS</h3>
<p>First, we will style the main container. Since our images have a maximum width of 680 pixel and a maximum height of 450 pixel, we will define the following values for the container (leaving some space for the dot list):</p>
<div id="highlighter_781054">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>.ps_container{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>    </code><code>display</code><code>:</code><code>none</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>    </code><code>width</code><code>:</code><code>680px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>    </code><code>height</code><code>:</code><code>500px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code>    </code><code>margin</code><code>:</code><code>20px</code> <code>auto</code> <code>0px</code> <code>auto</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>6</code></td>
<td><code>    </code><code>position</code><code>:</code><code>relative</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>7</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>Now we will style the wrapper for the full images. Here we really set the exact maximum dimensions and say that the overflow is hidden. We do that because we want to be able to put two images inside of this wrapper but cut off the overflow. In our JS function we will animate the images so that the current one gets revealed.<br />
We will center the wrapper by setting the left and right margins to “auto”:</p>
<div id="highlighter_507788">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>.ps_image_wrapper{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>width</code><code>:</code><code>680px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>height</code><code>:</code><code>450px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>overflow</code><code>:</code><code>hidden</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>position</code><code>:</code><code>relative</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>    </code><code>margin</code><code>:</code><code>0</code> <code>auto</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>-moz-</code><code>box-shadow</code><code>:</code><code>0px</code> <code>0px</code> <code>5px</code> <code>#999</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>-webkit-</code><code>box-shadow</code><code>:</code><code>0px</code> <code>0px</code> <code>5px</code> <code>#999</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>    </code><code>box-shadow</code><code>:</code><code>0px</code> <code>0px</code> <code>5px</code> <code>#999</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The image(s) inside of the wrapper should be of position absolute since we want to animate the left value to slide in the current image and slide out the previous one:</p>
<div id="highlighter_718372">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>.ps_image_wrapper img{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>    </code><code>position</code><code>:</code><code>absolute</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>    </code><code>left</code><code>:</code><code>0px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>    </code><code>top</code><code>:</code><code>0px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The navigation elements will have the following style:</p>
<div id="highlighter_408380">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>.ps_prev,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>.ps_next{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>width</code><code>:</code><code>30px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>height</code><code>:</code><code>59px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>position</code><code>:</code><code>absolute</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>    </code><code>top</code><code>:</code><code>50%</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>margin-top</code><code>:</code><code>-40px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>cursor</code><code>:</code><code>pointer</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>    </code><code>opacity</code><code>:</code><code>0.5</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>.ps_prev{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>    </code><code>background</code><code>:</code><code>transparent</code> <code>url</code><code>(../images/prev.png) </code><code>no-repeat</code> <code>top</code> <code>center</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>    </code><code>left</code><code>:</code><code>-50px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>.ps_next{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>    </code><code>background</code><code>:</code><code>transparent</code> <code>url</code><code>(../images/next.png) </code><code>no-repeat</code> <code>top</code> <code>center</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>17</code></td>
<td><code>    </code><code>right</code><code>:</code><code>-50px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>18</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>19</code></td>
<td><code>.ps_prev:hover,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>20</code></td>
<td><code>.ps_next:hover{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>21</code></td>
<td><code>    </code><code>opacity</code><code>:</code><code>0.9</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>22</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The dot list with the class “ps_nav” will be placed under the full image and centered by auto margins:</p>
<div id="highlighter_150620">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ul.ps_nav{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>    </code><code>list-style</code><code>:</code><code>none</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>    </code><code>margin</code><code>:</code><code>0</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>    </code><code>padding</code><code>:</code><code>0</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code>    </code><code>width</code><code>:</code><code>170px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>6</code></td>
<td><code>    </code><code>margin</code><code>:</code><code>20px</code> <code>auto</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>7</code></td>
<td><code>    </code><code>position</code><code>:</code><code>relative</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>8</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The dot list elements will float:</p>
<div id="highlighter_496721">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ul.ps_nav li{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>    </code><code>float</code><code>:</code><code>left</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>And the inner link elements will get the dot background image, which is a sprites image:</p>
<div id="highlighter_757116">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ul.ps_nav li a{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>    </code><code>display</code><code>:</code><code>block</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>    </code><code>text-indent</code><code>:</code><code>-9000px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>    </code><code>width</code><code>:</code><code>11px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code>    </code><code>height</code><code>:</code><code>11px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>6</code></td>
<td><code>    </code><code>outline</code><code>:</code><code>none</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>7</code></td>
<td><code>    </code><code>padding</code><code>:</code><code>0px</code> <code>3px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>8</code></td>
<td><code>    </code><code>background</code><code>:</code><code>transparent</code> <code>url</code><code>(../images/dot.png) </code><code>no-repeat</code> <code>top</code> <code>center</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>9</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>On hover we will change the background position to show the other half:</p>
<div id="highlighter_829799">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ul.ps_nav li a:hover,ul.ps_nav li.selected a{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>    </code><code>background-position</code><code>:</code><code>50%</code> <code>-11px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>Our special list element, the one that will have the thumbnail preview, will be of absolute positioning. The top has a negative value, since we want to pull this element up, beyond the list. The left value will be dynamically calculated. -34.5 pixel is the left value for the preview element when we want to show it over the first dot:</p>
<div id="highlighter_601805">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ul.ps_nav li.ps_preview{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>    </code><code>display</code><code>:</code><code>none</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>    </code><code>width</code><code>:</code><code>85px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>    </code><code>height</code><code>:</code><code>91px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code>    </code><code>top</code><code>:</code><code>-95px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>6</code></td>
<td><code>    </code><code>left</code><code>:</code><code>-34.5px</code><code>; </code><code>/*This we will calculate dynamically*/</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>7</code></td>
<td><code>    </code><code>position</code><code>:</code><code>absolute</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>8</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The span will be the little triangle:</p>
<div id="highlighter_834126">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ul.ps_nav li.ps_preview span{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>    </code><code>background</code><code>:</code><code>transparent</code> <code>url</code><code>(../images/triangle.png) </code><code>no-repeat</code> <code>top</code> <code>center</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>    </code><code>width</code><code>:</code><code>15px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>    </code><code>height</code><code>:</code><code>6px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code>    </code><code>position</code><code>:</code><code>absolute</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>6</code></td>
<td><code>    </code><code>top</code><code>:</code><code>85px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>7</code></td>
<td><code>    </code><code>left</code><code>:</code><code>35px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>8</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The preview wrapper will function the same way like the full image wrapper. We will hide the overflow:</p>
<div id="highlighter_269310">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>.ps_preview_wrapper{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>width</code><code>:</code><code>75px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>height</code><code>:</code><code>75px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>border</code><code>:</code><code>5px</code> <code>solid</code> <code>#fff</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>overflow</code><code>:</code><code>hidden</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>    </code><code>position</code><code>:</code><code>relative</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>-moz-</code><code>box-shadow</code><code>:</code><code>0px</code> <code>0px</code> <code>5px</code> <code>#999</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>-webkit-</code><code>box-shadow</code><code>:</code><code>0px</code> <code>0px</code> <code>5px</code> <code>#999</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>    </code><code>box-shadow</code><code>:</code><code>0px</code> <code>0px</code> <code>5px</code> <code>#999</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>And ultimately, we want the thumbnails to be of absolute positioning since we want to animate the left value for the sliding effect:</p>
<div id="highlighter_748314">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>.ps_preview_wrapper img{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>    </code><code>position</code><code>:</code><code>absolute</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>    </code><code>top</code><code>:</code><code>0px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>    </code><code>left</code><code>:</code><code>0px</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>And that’s all the style. Let add the jQuery spice!</p>
<h3>The JavaScript</h3>
<p>The idea of this gallery is to show little thumbnails when hovering over a dot that represents and image.</p>
<p>When moving the cursor over the dots, we want to create a sliding animation that moves the next currently hovered thumbnail image into place. This will create a great effect, giving the illusion that we have an invisible bar of thumbnail images above the dots and our preview element makes them visible.</p>
<p>We also want the clicked image to show up by “pushing” the current one away, either from the left or from the right side.</p>
<p>Both effects we will achieve by placing the images or thumbs next to each other and animating their left value accordingly.</p>
<p>So, let’s begin by caching some elements:</p>
<div id="highlighter_6535">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>var</code> <code>$ps_container       = $(</code><code>'#ps_container'</code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>$ps_image_wrapper   = $ps_container.find(</code><code>'.ps_image_wrapper'</code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>$ps_next            = $ps_container.find(</code><code>'.ps_next'</code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>$ps_prev            = $ps_container.find(</code><code>'.ps_prev'</code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>$ps_nav             = $ps_container.find(</code><code>'.ps_nav'</code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>    </code><code>$tooltip            = $ps_container.find(</code><code>'.ps_preview'</code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>    </code><code>$ps_preview_wrapper = $tooltip.find(</code><code>'.ps_preview_wrapper'</code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>$links              = $ps_nav.children(</code><code>'li'</code><code>).not($tooltip),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>    </code><code>total_images        = $links.length,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>    </code><code>currentHovered      = -1,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>    </code><code>current             = 0,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>    </code><code>$loader             = $(</code><code>'#loader'</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>(The loader element was not mentioned in the HTML structure since we placed it outside of the container. We want to show a loading element until all the images are loaded. In the download file you will be able to see the preload function for the images.)</p>
<p>Now we need to check if the browser is a real one or, for whatever insane reason, a crappy one like, let’s say, IE:</p>
<div id="highlighter_335273">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>var</code> <code>ie              = </code><code>false</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>if</code> <code>($.browser.msie) {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>    </code><code>ie = </code><code>true</code><code>; </code><code>// oh no sweet Jesus</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code>if</code><code>(!ie) </code><code>// there is a God</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>6</code></td>
<td><code>    </code><code>$tooltip.css({</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>7</code></td>
<td><code>        </code><code>opacity : 0</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>8</code></td>
<td><code>    </code><code>}).show();</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>Basically, we want to give the preview element or tooltip the opacity 0 and animate it to 1 when we hover over it. Since in IE it does not help to simply add an opacity filter (elements inside are still shown) we want to use the show/hide instead of animating the opacity. So, we add display:none to the style of the class but take it out if we don’t use IE.</p>
<p>After preloading the images, we will show the container:</p>
<div id="highlighter_616863">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>/*first preload images (thumbs and large images)*/</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>var</code> <code>loaded  = 0;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>$links.each(</code><code>function</code><code>(i){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>    </code><code>var</code> <code>$link   = $(</code><code>this</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>$link.find(</code><code>'a'</code><code>).preload({</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>        </code><code>onComplete  : </code><code>function</code><code>(){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>            </code><code>++loaded;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>            </code><code>if</code><code>(loaded == total_images){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>                </code><code>//all images preloaded,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>                </code><code>//show ps_container and initialize events</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>                </code><code>$loader.hide();</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>                </code><code>$ps_container.show();</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>                </code><code>//when mouse enters the the dots,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>                </code><code>//show the tooltip,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>                </code><code>//when mouse leaves hide the tooltip,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>                </code><code>//clicking on one will display the respective image</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>17</code></td>
<td><code>                </code><code>$links.bind(</code><code>'mouseenter'</code><code>,showTooltip)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>18</code></td>
<td><code>                      </code><code>.bind(</code><code>'mouseleave'</code><code>,hideTooltip)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>19</code></td>
<td><code>                      </code><code>.bind(</code><code>'click'</code><code>,showImage);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>20</code></td>
<td><code>                </code><code>//navigate through the images</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>21</code></td>
<td><code>                </code><code>$ps_next.bind(</code><code>'click'</code><code>,nextImage);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>22</code></td>
<td><code>                </code><code>$ps_prev.bind(</code><code>'click'</code><code>,prevImage);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>23</code></td>
<td><code>            </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>24</code></td>
<td><code>        </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>25</code></td>
<td><code>    </code><code>});</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>26</code></td>
<td><code>});</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The function <strong>showTooltip()</strong> will show the thumbnails preview and animate it to the right place. It will also slide the thumbnails inside, either to the right or to the left, depending where we are “coming from”:</p>
<div id="highlighter_238423">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>function</code> <code>showTooltip(){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>var</code> <code>$link           = $(</code><code>this</code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>        </code><code>idx             = $link.index(),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>        </code><code>linkOuterWidth  = $link.outerWidth(),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>        </code><code>//this holds the left value for the next position</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>        </code><code>//of the tooltip</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>        </code><code>left            = parseFloat(idx * linkOuterWidth) - $tooltip.width()/2 + linkOuterWidth/2,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>        </code><code>//the thumb image source</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>        </code><code>$thumb          = $link.find(</code><code>'a'</code><code>).attr(</code><code>'rel'</code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>        </code><code>imageLeft;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>    </code><code>//if we are not hovering the current one</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>    </code><code>if</code><code>(currentHovered != idx){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>        </code><code>//check if we will animate left-&gt;right or right-&gt;left</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>        </code><code>if</code><code>(currentHovered != -1){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>            </code><code>if</code><code>(currentHovered &lt; idx){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>17</code></td>
<td><code>                </code><code>imageLeft   = 75;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>18</code></td>
<td><code>            </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>19</code></td>
<td><code>            </code><code>else</code><code>{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>20</code></td>
<td><code>                </code><code>imageLeft   = -75;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>21</code></td>
<td><code>            </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>22</code></td>
<td><code>        </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>23</code></td>
<td><code>        </code><code>currentHovered = idx;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>24</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>25</code></td>
<td><code>        </code><code>//the next thumb image to be shown in the tooltip</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>26</code></td>
<td><code>        </code><code>var</code> <code>$newImage = $(</code><code>'&lt;img alt=""&gt;'</code><code>).css(</code><code>'left'</code><code>,</code><code>'0px'</code><code>)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>27</code></td>
<td><code>                                   </code><code>.attr(</code><code>'src'</code><code>,$thumb);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>28</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>29</code></td>
<td><code>        </code><code>//if theres more than 1 image</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>30</code></td>
<td><code>        </code><code>//(if we would move the mouse too fast it would probably happen)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>31</code></td>
<td><code>        </code><code>//then remove the oldest one (:last)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>32</code></td>
<td><code>        </code><code>if</code><code>($ps_preview_wrapper.children().length &gt; 1)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>33</code></td>
<td><code>            </code><code>$ps_preview_wrapper.children(</code><code>':last'</code><code>).remove();</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>34</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>35</code></td>
<td><code>        </code><code>//prepend the new image</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>36</code></td>
<td><code>        </code><code>$ps_preview_wrapper.prepend($newImage);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>37</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>38</code></td>
<td><code>        </code><code>var</code> <code>$tooltip_imgs       = $ps_preview_wrapper.children(),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>39</code></td>
<td><code>            </code><code>tooltip_imgs_count  = $tooltip_imgs.length;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>40</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>41</code></td>
<td><code>        </code><code>//if theres 2 images on the tooltip</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>42</code></td>
<td><code>        </code><code>//animate the current one out, and the new one in</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>43</code></td>
<td><code>        </code><code>if</code><code>(tooltip_imgs_count &gt; 1){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>44</code></td>
<td><code>            </code><code>$tooltip_imgs.eq(tooltip_imgs_count-1)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>45</code></td>
<td><code>                         </code><code>.stop()</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>46</code></td>
<td><code>                         </code><code>.animate({</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>47</code></td>
<td><code>                            </code><code>left:-imageLeft+</code><code>'px'</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>48</code></td>
<td><code>                          </code><code>},150,</code><code>function</code><code>(){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>49</code></td>
<td><code>                                </code><code>//remove the old one</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>50</code></td>
<td><code>                                </code><code>$(</code><code>this</code><code>).remove();</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>51</code></td>
<td><code>                          </code><code>});</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>52</code></td>
<td><code>            </code><code>$tooltip_imgs.eq(0)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>53</code></td>
<td><code>                         </code><code>.css(</code><code>'left'</code><code>,imageLeft + </code><code>'px'</code><code>)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>54</code></td>
<td><code>                         </code><code>.stop()</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>55</code></td>
<td><code>                         </code><code>.animate({</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>56</code></td>
<td><code>                            </code><code>left:</code><code>'0px'</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>57</code></td>
<td><code>                          </code><code>},150);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>58</code></td>
<td><code>        </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>59</code></td>
<td><code>    </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>60</code></td>
<td><code>    </code><code>//if we are not using a "browser", we just show the tooltip,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>61</code></td>
<td><code>    </code><code>//otherwise we fade it in</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>62</code></td>
<td><code>    </code><code>//</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>63</code></td>
<td><code>    </code><code>if</code><code>(ie)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>64</code></td>
<td><code>        </code><code>$tooltip.css(</code><code>'left'</code><code>,left + </code><code>'px'</code><code>).show();</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>65</code></td>
<td><code>    </code><code>else</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>66</code></td>
<td><code>    </code><code>$tooltip.stop()</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>67</code></td>
<td><code>            </code><code>.animate({</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>68</code></td>
<td><code>                </code><code>left        : left + </code><code>'px'</code><code>,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>69</code></td>
<td><code>                </code><code>opacity     : 1</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>70</code></td>
<td><code>            </code><code>},150);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>71</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p><img title="thumbnails" src="http://tympanus.net/codrops/wp-content/uploads/2011/01/thumbnails.jpg" alt="" width="478" height="236" /></p>
<p>The function <strong>hideTooltip()</strong> simply fades out the thumbnails preview (or hides it if IE):</p>
<div id="highlighter_373797">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>function</code> <code>hideTooltip(){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>//hide / fade out the tooltip</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>    </code><code>if</code><code>(ie)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>        </code><code>$tooltip.hide();</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>    </code><code>else</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>    </code><code>$tooltip.stop()</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code>            </code><code>.animate({</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>                </code><code>opacity     : 0</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>            </code><code>},150);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The following function will show an image in full size and animate the wrapper around to the right size. The new image will “slide into place”:</p>
<div id="highlighter_608569">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>function</code> <code>showImage(e){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code>    </code><code>var</code> <code>$link               = $(</code><code>this</code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code>        </code><code>idx                 = $link.index(),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code>        </code><code>$image              = $link.find(</code><code>'a'</code><code>).attr(</code><code>'href'</code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code>        </code><code>$currentImage       = $ps_image_wrapper.find(</code><code>'img'</code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code>        </code><code>currentImageWidth   = $currentImage.width();</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code>    </code><code>//if we click the current one return</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code>    </code><code>if</code><code>(current == idx) </code><code>return</code> <code>false</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>    </code><code>//add class selected to the current page / dot</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>    </code><code>$links.eq(current).removeClass(</code><code>'selected'</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>    </code><code>$link.addClass(</code><code>'selected'</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>    </code><code>//the new image element</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>    </code><code>var</code> <code>$newImage = $(</code><code>'&lt;img alt=""&gt;'</code><code>).css(</code><code>'left'</code><code>,currentImageWidth + </code><code>'px'</code><code>)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>17</code></td>
<td><code>                               </code><code>.attr(</code><code>'src'</code><code>,$image);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>18</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>19</code></td>
<td><code>    </code><code>//if the wrapper has more than one image, remove oldest</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>20</code></td>
<td><code>    </code><code>if</code><code>($ps_image_wrapper.children().length &gt; 1)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>21</code></td>
<td><code>        </code><code>$ps_image_wrapper.children(</code><code>':last'</code><code>).remove();</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>22</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>23</code></td>
<td><code>    </code><code>//prepend the new image</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>24</code></td>
<td><code>    </code><code>$ps_image_wrapper.prepend($newImage);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>25</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>26</code></td>
<td><code>    </code><code>//the new image width</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>27</code></td>
<td><code>    </code><code>//this will be the new width of the ps_image_wrapper</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>28</code></td>
<td><code>    </code><code>var</code> <code>newImageWidth   = $newImage.width();</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>29</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>30</code></td>
<td><code>    </code><code>//check animation direction</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>31</code></td>
<td><code>    </code><code>if</code><code>(current &gt; idx){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>32</code></td>
<td><code>        </code><code>$newImage.css(</code><code>'left'</code><code>,-newImageWidth + </code><code>'px'</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>33</code></td>
<td><code>        </code><code>currentImageWidth = -newImageWidth;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>34</code></td>
<td><code>    </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>35</code></td>
<td><code>    </code><code>current = idx;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>36</code></td>
<td><code>    </code><code>//animate the new width of the ps_image_wrapper</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>37</code></td>
<td><code>    </code><code>//(same like new image width)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>38</code></td>
<td><code>    </code><code>$ps_image_wrapper.stop().animate({</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>39</code></td>
<td><code>        </code><code>width   : newImageWidth + </code><code>'px'</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>40</code></td>
<td><code>    </code><code>},350);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>41</code></td>
<td><code>    </code><code>//animate the new image in</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>42</code></td>
<td><code>    </code><code>$newImage.stop().animate({</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>43</code></td>
<td><code>        </code><code>left    : </code><code>'0px'</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>44</code></td>
<td><code>    </code><code>},350);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>45</code></td>
<td><code>    </code><code>//animate the old image out</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>46</code></td>
<td><code>    </code><code>$currentImage.stop().animate({</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>47</code></td>
<td><code>        </code><code>left    : -currentImageWidth + </code><code>'px'</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>48</code></td>
<td><code>    </code><code>},350);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>49</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>50</code></td>
<td><code>    </code><code>e.preventDefault();</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>51</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The navigation functions will simply trigger a click event on the dots (which we already took care of in the beginning):</p>
<div id="highlighter_458750">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>function</code> <code>nextImage(){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>    </code><code>if</code><code>(current &lt; total_images){      $links.eq(current+1).trigger(</code><code>'click'</code><code>);  } } </code><code>function</code> <code>prevImage(){   </code><code>if</code><code>(current &gt; 0){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>        </code><code>$links.eq(current-1).trigger(</code><code>'click'</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>    </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>And that’s all! We hope you enjoyed the sweet thumbnails tutorial and find it useful!</p>
<div id="seo_alrp_related"><h2>Posts Related to how to add Sweet Thumbnails Preview Gallery</h2><ul><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/css-and-jquery-tutorial-fancy-apple-style-icon-slide-out-navigation/" rel="bookmark">CSS and jQuery Tutorial: Fancy Apple-Style Icon Slide Out Navigation</a></h3><p>1. The HTML The markup just consists of a div with an unordered list inside. The list elements contain a span for the icon and ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/all-fixed-fade-out-menu-a-css-and-jquery-tutorial/" rel="bookmark">all Fixed Fade Out Menu: A CSS and jQuery Tutorial</a></h3><p>1. The HTML The markup is pretty simple: we have a div with a list inside. The list items will be our links, the search ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/how-to-add-beautiful-slide-out-navigation-a-css-and-jquery-tutorial/" rel="bookmark">how to add Beautiful Slide Out Navigation: A CSS and jQuery Tutorial</a></h3><p>1. The HTML Structure The only thing we will need for the navigation is a simple unordered list with links inside of the list elements: ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/07/jquery-thumbnail-image-with-heading-and-caption/" rel="bookmark">Jquery Thumbnail Image with Heading and Caption</a></h3><p>Let's review a topic about how to create a Jquery Thumbnail Image with Heading and Caption. Have you ever seen Jquery Thumbnail Image with Heading ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2010/11/sleek-and-smooth-animated-menu-jquery/" rel="bookmark">Sleek and Smooth animated menu using jQuery</a></h3><p>Today, I’m going to show you something interesting with jQuery. Yesterday I was thinking something to post something programming related stuff  in blog after long ...</p></div></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.bageshsingh.com/bagesh-blog/2011/07/how-to-add-sweet-thumbnails-preview-gallery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Dialog Box Tutorial</title>
		<link>http://www.bageshsingh.com/bagesh-blog/2011/07/jquery-dialog-box-tutorial/</link>
		<comments>http://www.bageshsingh.com/bagesh-blog/2011/07/jquery-dialog-box-tutorial/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 17:11:42 +0000</pubDate>
		<dc:creator>Bagesh Singh</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[Home]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[JQuery Interview Questions]]></category>
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://www.bageshsingh.com/bagesh-blog/?p=1384</guid>
		<description><![CDATA[Recently on a coding project for my day job I had a requirement to display a dialog box to confirm that when someone clicked a cancel link that they meant to do the cancel action. The dialog box was on a page that built a list of links with multiple cancel links, each with a [...]]]></description>
			<content:encoded><![CDATA[<p>Recently on a coding project for my day job I had a requirement to display a dialog box to confirm that when someone clicked a cancel link that they meant to do the cancel action. The dialog box was on a page that built a list of links with multiple cancel links, each with a different url. Since we are using jQuery and since I didn&#8217;t want a browser dialog box to display I decided to use the jQuery dialog box.</p>
<p>Since I am a firm believer in the first rule of programming (never re-write something that has already been written) I did a quick Google search and found a good example of the jQuery dialog box for when a form is submitted at jensbits.com. The code was close to what I wanted to do, but not exactly. So, I took the code and modified it to work for me.</p>
<p>Below is the portion of the jQuery code that I changed from the code in the jensbits.com post.</p>
<blockquote><p><code><br />
</code></p>
<div><code>$(function(){<br />
// jQuery UI Dialog </code>$(&#8216;#dialog&#8217;).dialog({<br />
autoOpen: false,<br />
width: 400,<br />
modal: true,<br />
resizable: false,<br />
buttons: {<br />
&#8220;Yes&#8221;: function() {<br />
$(this).dialog(&#8220;close&#8221;);<br />
$(location).attr(&#8216;href&#8217;,$(this).dialog(&#8216;option&#8217;, &#8216;anchor&#8217;));<br />
return true;<br />
},<br />
&#8220;No&#8221;: function() {<br />
$(this).dialog(&#8220;close&#8221;);<br />
return false;<br />
}<br />
}<br />
});</p>
<p>$(&#8216;.closebutton&#8217;).click(function(){<br />
$(&#8216;#dialog&#8217;).dialog(&#8216;option&#8217;, &#8216;anchor&#8217;, $(this).attr(&#8216;href&#8217;));<br />
$(&#8216;#dialog&#8217;).dialog(&#8216;open&#8217;);<br />
return false;<br />
});<br />
});</p>
</div>
<p><code> </code>&nbsp;</p></blockquote>
<p>My first modification was to have the dialog open when someone clicks on a link that has a closebutton class assigned to it. I also attached an anchor option to the dialog box that holds the href attribute value of the link.</p>
<blockquote><p><code><br />
$('.closebutton').click(function(){<br />
$('#dialog').dialog('option', 'anchor', $(this).attr('href'));<br />
$('#dialog').dialog('open');<br />
return false;<br />
});<br />
</code></p></blockquote>
<p>The below code shows the setup of the buttons and the major change is that the &#8220;Yes&#8221; button sets the location attribute to the anchor option value that we set in the code above.</p>
<blockquote><p><code><br />
buttons: {<br />
"Yes": function() {<br />
$(this).dialog("close");<br />
$(location).attr('href',$(this).dialog('option', 'anchor'));<br />
return true;<br />
},<br />
"No": function() {<br />
$(this).dialog("close");<br />
return false;<br />
}<br />
}<br />
</code></p></blockquote>
<p>Below is the code in the body of the html that sets up the links and the dialog box. Notice that each link has the class set to closebutton.</p>
<blockquote><p><code><br />
</code></p>
<div><code> &lt;a id="closebutton1" href="http://ocell.us"&gt;Close&lt;/a&gt;&lt;br /&gt;<br />
&lt;a id="closebutton2" href="http://wastingtimegames.com"&gt;Close&lt;/a&gt;&lt;br /&gt;<br />
&lt;a id="closebutton3" href="http://theporscheguys.com"&gt;Close&lt;/a&gt;<br />
&lt;div id="dialog" title="Cancel"&gt;&lt;p&gt;&lt;span style="float:left; margin:0 7px 0 0;"&gt;&lt;/span&gt; Are you sure you want to do that?&lt;/p&gt;&lt;p&gt;<br />
If you are sure, click Yes.&lt;/p&gt;&lt;p&gt;If not click No.&lt;p&gt;&lt;/div&gt; </code></div>
<p><code> </code>&nbsp;</p></blockquote>
<p>You can see the full demo code here. It is a text file for easy code viewing, but you can save it to your computer if you want to see it in action.</p>
<div id="seo_alrp_related"><h2>Posts Related to jQuery Dialog Box Tutorial</h2><ul><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/02/load-a-page-dynamically-inside-the-jquery-ui-dialog/" rel="bookmark">Load a Page Dynamically inside the jQuery UI Dialog</a></h3><p>The jQuery UI Dialog is a floating window that contains a title bar and a content area. The dialog window can be moved, resized and ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2011/02/use-jquery-to-scroll-to-bottom-or-top-of-a-page/" rel="bookmark">Use jQuery to Scroll to Bottom or Top of a Page</a></h3><p>I had recently written about how to Use jQuery to Detect if User has Scrolled to the Bottom or Top of a Page. A DevCurry.com ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2010/11/top-floating-message-box-using-jquery-2/" rel="bookmark">Top Floating message box using jQuery</a></h3><p>I’ve shown you how to create a alert box using jQuery. This time, I’ve come up with another tutorial to show you how to display ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2010/11/model-file-upload-overlay-box-jquery-and-thickbox/" rel="bookmark">Model File upload overlay box using jQuery and Thickbox</a></h3><p>Few times back, sNare asked me how do display wordpress like overlay box where you can pass the variables when you click on the link ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.bageshsingh.com/bagesh-blog/2010/10/adding-css-class-name-to-my-account-link-anchor-tag-in-magento-through-xml-layout/" rel="bookmark">Adding CSS Class name to My Account Link (Anchor Tag) in Magento through XML Layout</a></h3><p>At the first instance I thought WTH! must be pretty simple, add params in XML layout and “Voila!“. But later I found that it was ...</p></div></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.bageshsingh.com/bagesh-blog/2011/07/jquery-dialog-box-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

