<?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>The Book and the Cover &#187; jQuery</title>
	<atom:link href="http://benjaminsterling.com/category/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://benjaminsterling.com</link>
	<description>Ok, you did not judge the book by it&#039;s cover, great.  Now, read the whole thing before passing judgment.</description>
	<lastBuildDate>Tue, 24 Mar 2009 19:25:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Portfolio Layout Idea Using jQuery</title>
		<link>http://benjaminsterling.com/portolio-layout-idea-using-jquery/</link>
		<comments>http://benjaminsterling.com/portolio-layout-idea-using-jquery/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 19:16:23 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=133</guid>
		<description><![CDATA[
The Inspiration
A few weeks back a good friend of mine needed to put together a website to display some of her drawings/portfolio pieces.  And of course I decided to go with my jqGalScroll plugin but it got me thinking that there really should be a better way of displaying her work.
After digging around I [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://benjaminsterling.com/wp-content/uploads/2008/12/portfolio1.jpg" alt="" title="portfolio1" class="aligncenter size-full wp-image-134" /></p>
<h3>The Inspiration</h3>
<p>A few weeks back a <a href="http://subunittwo.com/">good friend of mine</a> needed to put together a website to display some of her drawings/portfolio pieces.  And of course I decided to go with my jqGalScroll plugin but it got me thinking that there really should be a better way of displaying her work.</p>
<p>After digging around I came across <a href="http://thunderfuel.com">thunderfuel's</a> website and was like "OMG, I must make that" and well, I did, sorta.  I built the foundation and since I am really not a design person I did not make it all that pretty, so feel free to take what I did and make it pretty.</p>
<p><a href="http://www.benjaminsterling.com/wp-content/files/porfolio1/" class="example {w:850,h:450}">Demo of the Portfolio idea</a></p>
<h3>The HTML</h3>
<p>As always, I am using a definition list:</p>
<div class="igBar"><span id="lhtml-5"><a href="#" onclick="javascript:showPlainTxt('html-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-5">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/dl.html"><span style="color: #000000; font-weight: bold;">&lt;dl</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"portfolio"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/dt.html"><span style="color: #000000; font-weight: bold;">&lt;dt&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"smallerImage.jpg"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"cubes still life"</span>&nbsp; /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">''</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>Domain.com<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dt&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">&lt;dd&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/h3.html"><span style="color: #000000; font-weight: bold;">&lt;h3&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">&lt;span&gt;</span></a></span>Project:<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/span&gt;</span></span> The Project <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h3&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/h4.html"><span style="color: #000000; font-weight: bold;">&lt;h4&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">&lt;span&gt;</span></a></span>Client:<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/span&gt;</span></span> Acme <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h4&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></a></span>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"biggerImage.jpg"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"cubes still life"</span>&nbsp; /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dd&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!--&nbsp; more piece adding up to an even number --&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dl&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>The CSS</h3>
<p>Nothing overly special, anything with height, width, or padding is needed, coloring and font styles are optional:</p>
<div class="igBar"><span id="lcss-6"><a href="#" onclick="javascript:showPlainTxt('css-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-6">
<div class="css">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#portfolio<span style="color: #66cc66;">&#123;</span><span style="color: #000000; font-weight: bold;">position</span>:<span style="color: #993333;">relative</span>;width:850px;height:450px;margin:<span style="color: #cc66cc;color:#800000;">0</span>;padding:<span style="color: #cc66cc;color:#800000;">0</span>;overflow:<span style="color: #993333;">hidden</span>;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#portfolio dd<span style="color: #66cc66;">&#123;</span><span style="color: #000000; font-weight: bold;">position</span>:<span style="color: #993333;">absolute</span>;left:250px;top:-455px;width:330px;height:430px;margin:<span style="color: #cc66cc;color:#800000;">0</span>;padding:<span style="color: #cc66cc;color:#800000;">0</span>;background:#666600;padding:10px;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#portfolio dd h3<span style="color: #66cc66;">&#123;</span>font<span style="color: #3333ff;">:<span style="color: #993333;">bold</span> </span>15px Georgia, <span style="color: #ff0000;">"Times New Roman"</span>, Times, <span style="color: #993333;">serif</span>;color:#fff;margin-<span style="color: #000000; font-weight: bold;">bottom</span>:<span style="color: #cc66cc;color:#800000;">0</span>;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#portfolio dd h4<span style="color: #66cc66;">&#123;</span>font<span style="color: #3333ff;">:<span style="color: #993333;">bold</span> </span>13px Georgia, <span style="color: #ff0000;">"Times New Roman"</span>, Times, <span style="color: #993333;">serif</span>;color:#fff;margin-<span style="color: #000000; font-weight: bold;">bottom</span>:<span style="color: #cc66cc;color:#800000;">0</span>;margin-<span style="color: #000000; font-weight: bold;">top</span>:<span style="color: #cc66cc;color:#800000;">0</span>;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#portfolio dd p<span style="color: #66cc66;">&#123;</span>font<span style="color: #3333ff;">:11px </span>Geneva, Arial, Helvetica, <span style="color: #993333;">sans-serif</span>;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#portfolio dd img<span style="color: #66cc66;">&#123;</span><span style="color: #000000; font-weight: bold;">display</span>:<span style="color: #993333;">block</span>;margin<span style="color: #3333ff;">:<span style="color: #cc66cc;color:#800000;">0</span> </span>auto;border<span style="color: #3333ff;">:3px </span>solid #999999<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.dt<span style="color: #66cc66;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span>:240px;height:65px;background:#808040;font<span style="color: #3333ff;">:11px </span>Geneva, Arial, Helvetica, <span style="color: #993333;">sans-serif</span>;padding:5px;margin:<span style="color: #cc66cc;color:#800000;">0</span>;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #6666ff;">.dt </span>img<span style="color: #66cc66;">&#123;</span>border<span style="color: #3333ff;">:2px </span>solid #fff;height:55px;width:55px;float:<span style="color: #000000; font-weight: bold;">left</span>;margin-<span style="color: #000000; font-weight: bold;">right</span>:5px;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #6666ff;">.dt </span>a<span style="color: #66cc66;">&#123;</span><span style="color: #000000; font-weight: bold;">display</span>:<span style="color: #993333;">block</span>;color:#fff;font<span style="color: #3333ff;">:<span style="color: #993333;">bold</span> </span>13px Georgia, <span style="color: #ff0000;">"Times New Roman"</span>, Times, <span style="color: #993333;">serif</span>;padding-<span style="color: #000000; font-weight: bold;">bottom</span>:5px;text-decoration:<span style="color: #993333;">none</span>;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.dt.<span style="color: #000000; font-weight: bold;">left</span><span style="color: #66cc66;">&#123;</span><span style="color: #000000; font-weight: bold;">position</span>:<span style="color: #993333;">absolute</span>;left:0px;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.dt.<span style="color: #000000; font-weight: bold;">right</span><span style="color: #66cc66;">&#123;</span><span style="color: #000000; font-weight: bold;">position</span>:<span style="color: #993333;">absolute</span>;right:0px;<span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>The JavaScript</h3>
<p>I am using the the <a href="http://gsgd.co.uk/sandbox/jquery/easing/">easing plugin</a> in my example so be sure to grab that also:</p>
<div class="igBar"><span id="ljavascript-7"><a href="#" onclick="javascript:showPlainTxt('javascript-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-7">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script type=<span style="color: #3366CC;">"text/javascript"</span> src=<span style="color: #3366CC;">"jquery-1.2.6.min.js"</span>&gt;&lt;/script&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script type=<span style="color: #3366CC;">"text/javascript"</span> src=<span style="color: #3366CC;">"jquery.easing.1.3.js"</span>&gt;&lt;/script&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Here is the actual code being used:</p>
<div class="igBar"><span id="ljavascript-8"><a href="#" onclick="javascript:showPlainTxt('javascript-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-8">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script type=<span style="color: #3366CC;">"text/javascript"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span>document<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">ready</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> hght = <span style="color: #CC0000;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'dt'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'dt'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> i % <span style="color: #CC0000;color:#800000;">2</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'left'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'top'</span>,hght<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hght += <span style="color: #CC0000;color:#800000;">75</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">else</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'right'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'top'</span>,hght<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#portfolio dd:animated'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">size</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> that = $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#portfolio dd.showing'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">animate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>top:-<span style="color: #CC0000;color:#800000;">455</span><span style="color: #66cc66;">&#125;</span>, <span style="color: #CC0000;color:#800000;">750</span>, <span style="color: #3366CC;">'easeOutQuad'</span>, <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">removeClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'showing'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; that.<span style="color: #006600;">next</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">animate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>top:<span style="color: #CC0000;color:#800000;">0</span><span style="color: #66cc66;">&#125;</span>, <span style="color: #CC0000;color:#800000;">750</span>, <span style="color: #3366CC;">'easeInQuad'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'showing'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">next</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">animate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>top:<span style="color: #CC0000;color:#800000;">0</span><span style="color: #66cc66;">&#125;</span>, <span style="color: #CC0000;color:#800000;">750</span>, <span style="color: #3366CC;">'easeInQuad'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'showing'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/script&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><a href="http://www.benjaminsterling.com/wp-content/files/porfolio1/" class="example {w:850,h:450}">Demo of the Portfolio idea</a></p>
<h3>The Improvements</h3>
<p>So what else could be done to this example to give more of a WOW factor?  Of the top of my head I can think of a few.  Of course a good amount of WOW can be received from a good design instead of green on green, but what about an automatic slide show?  What about different directions of the animation, ie. one from the left, one from the right, one from top and so on?</p>
<p>Be all mean, let me know what you come up with.</p>
<p><strong>Update:</strong> Made a change to the easing methods to easeOutQuad and easeInQuad, should be less jarring.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/portolio-layout-idea-using-jquery/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Password Strength Indicator and Generator</title>
		<link>http://benjaminsterling.com/password-strength-indicator-and-generator/</link>
		<comments>http://benjaminsterling.com/password-strength-indicator-and-generator/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 16:00:51 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Plugin]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=117</guid>
		<description><![CDATA[Sometimes you want to show your user the strength of their password and although there a quite a few jQuery "plugins" that do this there are none - that I've found - that let you set the class of an element so that you can do a graphical representation of the strength.
What I have put [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you want to show your user the strength of their password and although there a quite a few jQuery "plugins" that do this there are none - that I've found - that let you set the class of an element so that you can do a graphical representation of the strength.</p>
<p>What I have put together is some code that I have been using on a few projects and turned it into a rough plugin.  I say a rough plugin because it is very basic and not entirely flexible; let's just call it a proof-of-concept.</p>
<p><a class="example {w:300,h:300}" data="" title="example" target="_blank" href="/wp-content/files/passwordstrength.htm">Live Demo of Password strength indicator and generator</a></p>
<p>In the example about you will see two password boxes and with them you have a generate password link and an icon showing you the strength of your password.</p>
<p>The first example you notice that I have a basic indicator showing the strength is the form a colors blocks going from green to red with red being the strongest indicator. (I got these images from the cpanel password changer)</p>
<p><img class="aligncenter" src="http://www.benjaminsterling.com/wp-content/files/passwordstrength/progressImg1.png" alt="" /></p>
<p>This is what you would normally see and it is fine, but what if your design is much like my current design where you are featuring trees?</p>
<p>In the second example we simply swap out the icon for a tree that has four levels and when the password is real strong the tree is completely filled in with red.</p>
<p><img class="aligncenter" src="http://www.benjaminsterling.com/wp-content/files/passwordstrength/progressImg2.png" alt="tree strength indicator" /></p>
<p>Have a look at the code:</p>
<p><a class="thecode {w:600,h:400}" data="" title="code" target="_blank" href="/wp-content/files/passwordstrength.txt">The Code for Password strength indicator and generator</a></p>
<p>By default the plugin will work off of ten default classes that you can set the css for which you can do an image sprite like I did above. Or maybe just a DIV with specific colors and widths that will illustrate a growing strength of a password.</p>
<h3>Final Thoughts</h3>
<p>The point of this post is to show you that you don't need to limit yourself to what is already out there, expand your thinking to include all possibilities and not just prepackaged ones.</p>
<p>With that said, what other possibilities do we have for a simple thing like a password strength indicator?  Hmm... maybe doing a meter type thing that goes from zero to a hundred and just rotate the pointer much like the <a href="http://css-tricks.com/css3-clock/" target="_blank">clock example</a>?</p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/password-strength-indicator-and-generator/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Really Simple History: Ajax history and bookmarking library</title>
		<link>http://benjaminsterling.com/really-simple-history-ajax-history-and-bookmarking-library/</link>
		<comments>http://benjaminsterling.com/really-simple-history-ajax-history-and-bookmarking-library/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 16:00:51 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=119</guid>
		<description><![CDATA[For some time now I have been using Really Simple History for my applications that use a good amount of AJAX.  RSH is exactly what it sounds like, it is a really simple way of adding history and bookmarking to your AJAXified apps.  To see it in action have a look at the Mason's [...]]]></description>
			<content:encoded><![CDATA[<p>For some time now I have been using <a href="http://code.google.com/p/reallysimplehistory/" target="_blank">Really Simple History </a>for my applications that use a good amount of <abbr title="asynchronous JavaScript and XML">AJAX</abbr>.  <abbr title="Really Simple History">RSH</abbr> is exactly what it sounds like, it is a really simple way of adding history and bookmarking to your AJAXified apps.  To see it in action have a look at the <a href="http://admissions.gmu.edu/grad/matrix/" target="_blank">Mason's Graduate Requirements</a> site where it is being used to handle bookmarking for four separate parameters.</p>
<p>What I want to cover in the article is what I have learned and what steps I took when coding with RSH for the Mason project and for some other on going projects.</p>
<p>First thing you should do is download the <a href="http://reallysimplehistory.googlecode.com/files/RSH0.6FINAL.zip" target="_blank">Really Simple History code</a>.</p>
<p>Secondly, I have been using a modified version of <a href="http://adamv.com/dev/javascript/querystring" target="_blank">Adam Vandenberg's Querystring</a> functions which has only one modification to it.</p>
<div class="igBar"><span id="ljavascript-13"><a href="#" onclick="javascript:showPlainTxt('javascript-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-13">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>qs == <span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> qs = location.<span style="color: #006600;">search</span>.<span style="color: #006600;">substring</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">1</span>, location.<span style="color: #006600;">search</span>.<span style="color: #006600;">length</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// changed to</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>qs == <span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> qs = location.<span style="color: #006600;">hash</span>.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066FF;">/^.*#/</span>, <span style="color: #3366CC;">''</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You will need to set up your script is a particular way so that the history script is created first, and then initialized, at least the way I do it, when DOM is ready.  You can get away with doing it on Window.onload but since most likely your code will be minipulating the DOM, initializing on DOM ready is probably better for you.</p>
<p>I set up my inital code like below:</p>
<div class="igBar"><span id="ljavascript-14"><a href="#" onclick="javascript:showPlainTxt('javascript-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-14">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> initail = <span style="color: #003366; font-weight: bold;">false</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> qs = <span style="color: #003366; font-weight: bold;">null</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">window.<span style="color: #006600;">dhtmlHistory</span>.<span style="color: #006600;">create</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span>document<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">ready</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dhtmlHistory.<span style="color: #006600;">initialize</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dhtmlHistory.<span style="color: #006600;">addListener</span><span style="color: #66cc66;">&#40;</span>theListener<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>!initail<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; theListener<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Lines 1 and 2 we set up some globals we will be reusing later on and line 4 we create the history object.  Lines 5 and 6 should be familiar to you, here we just check to see if the DOM is ready, if so, we run the code in the containing function.  Line 8 we initialize the history script and at line 9 we set the listener to "theListener" which is a function I will point out further down the page.  You will see that I also have an IF statement that is checking to see if this is the initial run.  This is because the the RSH script does not run the listener script when it is initialized.</p>
<p>The next function is just a helper function I use all the time when dealing with the hash:</p>
<div class="igBar"><span id="ljavascript-15"><a href="#" onclick="javascript:showPlainTxt('javascript-15'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-15">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">hash = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> location.<span style="color: #006600;">hash</span>.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066FF;">/^.*#/</span>, <span style="color: #3366CC;">''</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The last function is the "theListener" function which I referenced at line 9 of the second group of codes.  This function will get called each and every time the hash changes.</p>
<div class="igBar"><span id="ljavascript-16"><a href="#" onclick="javascript:showPlainTxt('javascript-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-16">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">theListener = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>!initail<span style="color: #66cc66;">&#41;</span> initail = <span style="color: #003366; font-weight: bold;">true</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; qs = <span style="color: #003366; font-weight: bold;">new</span> Querystring<span style="color: #66cc66;">&#40;</span> hash<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000066; font-weight: bold;">typeof</span> qs.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'cat'</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #3366CC;">'undefined'</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// run cat specific code</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Although the RSH script does pass back two params you will see that I don't use them and the only real reason for this is that I felt it was too complicated and I never really figured out how I should use them.</p>
<p>At line 2 of the function we check to see if the function was already initiated.  Then at line 3 we set up a new Querystring reference - should probably change the name to hashstring or something like that at some point.  And from this point on, you can check your query string for what ever parameters you need to and run the appropriate codes.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/really-simple-history-ajax-history-and-bookmarking-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blog News Ticker</title>
		<link>http://benjaminsterling.com/blog-news-ticker/</link>
		<comments>http://benjaminsterling.com/blog-news-ticker/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 16:00:44 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=118</guid>
		<description><![CDATA[Recently I had been asked to help put together a post scroller widget for a WordPress install but sadly after it was nearly completed it was agreed that it would not "fit" the site it was meant for.  And it is true, some sites, depending on who the site is meant for - the [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had been asked to help put together a post scroller widget for a WordPress install but sadly after it was nearly completed it was agreed that it would not "fit" the site it was meant for.  And it is true, some sites, depending on who the site is meant for - the targeted audience - or what the main topic of the site really don't need bells and whistles to get content in front of their users.  Since I did not want all that work go to waste I figured I'd write up a post on the code and thought processes.</p>
<h3>Ideals</h3>
<p>I firmly believe that a site should still be functional, 508 compliant and still look good when styles and JavaScript are turned off.  With this in mind we will be doing some "progressive enhancements" and since there is going to very little that won't work in all browsers I won't go into my rant about <abbr title="progressive enhancements">PE</abbr>.</p>
<h3>Structure</h3>
<p>We will be using Definition lists; why definition lists?  Because they are semantically correct for this situation.  Have a look at two really good articles from <a href="http://css-tricks.com/utilizing-the-underused-but-semantically-awesome-definition-list/">Css-tricks.com</a> and <a href="http://www.maxdesign.com.au/presentation/definition/">Maxdesign.com</a> which go into detail on why you should use definition lists.</p>
<p>Below is the structure we will be dealing with, notice that we only have the DL/DT/DD structure and now wrapping DIV or any other extra mark up:</p>
<div class="igBar"><span id="lhtml-19"><a href="#" onclick="javascript:showPlainTxt('html-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-19">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/h3.html"><span style="color: #000000; font-weight: bold;">&lt;h3&gt;</span></a></span>Our News<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h3&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/dl.html"><span style="color: #000000; font-weight: bold;">&lt;dl</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"newsScroller"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/dt.html"><span style="color: #000000; font-weight: bold;">&lt;dt&gt;</span></a></span>Title<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dt&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">&lt;dd&gt;</span></a></span>Excerpt<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dd&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">&lt;dd&gt;</span></a></span>Date<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dd&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">&lt;dd&gt;</span></a></span>Tags and comment count<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dd&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dl&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>With <abbr title="progressive enhancements">PE</abbr> in mind, we will use JavaScript to add in any additional mark up we will need to achieve the scroller look.</p>
<p><a class="example {h:400,w:600}" data="" title="example" target="_blank" href="/wp-content/files/newsScroller.htm">Current Progress</a></p>
<p>The content from our current progress is from a dump I did of my own site using WordPress' loop.</p>
<h3>Styling</h3>
<p>In our next layer of PE will are going to add in some style simple based off of the current structure minus the JavaScript.</p>
<p><a class="example {h:400,w:600}" data="" title="example" target="_blank" href="/wp-content/files/newsScroller2.htm">Current Progress</a></p>
<p>In this phase we really did not do anything special, I just styled it as I would have normally.  You can add more pop to it if you feel.  Do note however, that at line 28 I am using a selector that <abbr title="Internet Explore 6">IE6</abbr> does not support and since the extra padding for that element is a nice to have and really does not hold the user of IE6 back I felt it was ok to add that in there.</p>
<div class="igBar"><span id="lcss-20"><a href="#" onclick="javascript:showPlainTxt('css-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-20">
<div class="css">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">dl#newsScroller dd + dd<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; padding<span style="color: #3333ff;">:<span style="color: #cc66cc;color:#800000;">0</span> </span><span style="color: #cc66cc;color:#800000;">0</span> <span style="color: #cc66cc;color:#800000;">0</span> 22px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>JavaScript</h3>
<p>Now we start with the real fun, using JavaScript - in this instance, jQuery as our framework of choice, but you can just as easily use MooTools or DoJo - to add in some WOW factor.  Here the plan is to wrap the DL in a DIV, add some classes to some elements, set up some events, and animations.</p>
<p>What we have in the example just below is some additional styles and elements.</p>
<p><a class="example {h:400,w:600}" data="" title="example" target="_blank" href="/wp-content/files/newsScroller3.htm">Current Progress</a></p>
<p>Finally we have to set up the events and animation; what events do we need to set up and why? We need to bind the <em>mouseenter</em> and <em>mouseleave</em> event because if we want to be able to read what is being shown we need to be able to put our mouse over the content and have it stop any animations that are running so we can read it.</p>
<p>First thing we will need to do is to find out the total height of the grouped content is.  The grouped content in this case is the <em>DT/DD/DD/DD</em> combination.  We will be using the <em>outerHeight()</em> method to get the total height (padding/margin/height). To get that grouped content we will be using a combination of <em>.children()</em> and <em>.slice().</em></p>
<p><a class="example {h:400,w:600}" data="" title="example" target="_blank" href="/wp-content/files/newsScroller4.htm">Final</a></p>
<p><a class="thecode {h:400,w:600}" data="" title="example" target="_blank" href="/wp-content/files/newsScroller4.txt">Final</a></p>
<h3>Closing</h3>
<p>So with the final product we have a decent footprint to stylize to your likings.  Feel free to stylize it, add new functionality, new animation - some easin/easeout effects would look nice.  Think outside of the box, just make sure it degrades nicely.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/blog-news-ticker/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Send Email Notifications for Broken Images Using jQuery Ajax</title>
		<link>http://benjaminsterling.com/send-email-notifications-for-broken-images-using-jquery-ajax/</link>
		<comments>http://benjaminsterling.com/send-email-notifications-for-broken-images-using-jquery-ajax/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 16:00:51 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[Error]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=120</guid>
		<description><![CDATA[David Walsh posted a priceless and overly useful post about Send Email Notifications for Broken Images Using MooTools Ajax but the only problem with that is that he used MooTools ;).
For those that want to do the same thing with jQuery here is the JavaScript code, please have a read at his post for the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://davidwalsh.name">David Walsh</a> posted a priceless and overly useful post about <a href="http://davidwalsh.name/email-image-error-mootools">Send Email Notifications for Broken Images Using MooTools Ajax</a> but the only problem with that is that he used MooTools ;).</p>
<p>For those that want to do the same thing with jQuery here is the JavaScript code, please have a read at <a href="http://davidwalsh.name/email-image-error-mootools">his post for the PHP code and any discussion his post sparks.</a></p>
<div class="igBar"><span id="ljavascript-22"><a href="#" onclick="javascript:showPlainTxt('javascript-22'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-22">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span>document<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">ready</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'img'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">error</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; $.<span style="color: #006600;">post</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'ajax-image-error.php'</span>,<span style="color: #66cc66;">&#123;</span><span style="color: #3366CC;">'image'</span>:<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">src</span>,<span style="color: #3366CC;">'page'</span>:location.<span style="color: #006600;">href</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Yeah, I know, there is so much less code then the MooTools example, why is that?  Psstt... because jQuery is better ;).</p>
<p><a href="http://www.benjaminsterling.com/wp-content/files/brokenImages.htm" target="_blank" class="example {h:400,w:600}" data="">Here is a live demo (an email is not sent, but the returned data is appended to the page.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/send-email-notifications-for-broken-images-using-jquery-ajax/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Web Tech November Meetup Presentation</title>
		<link>http://benjaminsterling.com/web-tech-november-meetup-presentation/</link>
		<comments>http://benjaminsterling.com/web-tech-november-meetup-presentation/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 17:35:00 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Presentations]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=116</guid>
		<description><![CDATA[Last night I had the opportunity to speak at the Web Tech November Meetup in Baltimore about jQuery.  I focused mainly on traversing since I believe once you fully grasp some of the built in jQuery traversing methods you can do just about anything using jQuery and do it easily.
Preparations
I spent about three weeks getting [...]]]></description>
			<content:encoded><![CDATA[<p>Last night I had the opportunity to speak at the <em>Web Tech November Meetup </em>in Baltimore about jQuery.  I focused mainly on <em>traversing</em> since I believe once you fully grasp some of the built in jQuery traversing methods you can do just about anything using jQuery and do it easily.</p>
<h3>Preparations</h3>
<p>I spent about three weeks getting this presentation together with the hopes that everything I talked about would be self-explanatory.  For the most part it was, there was some items that I should have wrote differently as to not make it look complicated.  Over all I think most of the items just flowed well.</p>
<p>My preparations went something like this, first I went through most of the code I had written over the past two months.  As I went through the code I made a tally of what traversing methods where used and how often.  I was suprise to see that I used <em>.eq() </em>quite often, guess I am glad jQuery brought that back quickly after the move to the <em>.slice()</em> method back at <em>1.1.4</em>.  The others that ranked pretty high were <em>.is(), .hasClass()</em> and <em>.not()</em>.</p>
<p>Since that list is pretty small I decided to go through some of the "help" emails, IMs and twitter messages I have gotten over the past couple of months and although I took some more complex routes with the answers I provided, after looking at them again they could have been accomplished better by using some of the family methods.  Yes, I am coining a new phrase for a group of methods.  Those methods are <em>.children()</em>, <em>.parent()</em>, <em>.parents()</em>, <em>.siblings()</em>, and the cousins <em>.next()</em> and <em>.prev()</em>.  I also through in <em>.end()</em> since this can be a very useful method and helps the chaining a bunch of calls together.</p>
<p>I know that I am much better presentor when i present on the fly with minimum talking points, so actually creating a slideshow and talking off of that slide show was going to very hard for me.  After many, many edits to my talking points that I had written down and desided to put pen to paper or mouse pointer to web browser.  I signed up for an account with <a href="http://280slides.com/" target="_blank">280slides</a>, started making my slide.  Although the app does not offer the same flexiblity or features that a desktop app would provide, it was pretty damned close.  My hat goes off to the developers of that app, it is quite nice.</p>
<p>After some time, about two weeks, I finally got the presentation done the day before I was to present.  I went to the slides over and over again and noted what points I should make what points were less important and depending on how well the presentation was going, I would expand on those talking points.</p>
<h3>The Presentation</h3>
<p>The meetup did not have a big turn out so the nervousness I had before hand disapated enough for me to get in to my zone.  I started off by introducing myself and did my best to keep away from any self depricating statements that I am so very skilled at.  Told the group what I would be focusing on, Selecting, Caching, Traversing, and we were on our way.</p>
<p>The group consisted of a few JavaScript rookies and JavaScript novices but for the most part, everyone knew CSS.  So for selectors, I focused on if you know CSS then you know how to select DOM elements in jQuery.  It really is that simple.  I explained the <em>Hierarchy Selectors</em> since a good majority of people I've helped over the years don't fully grasp them.  The main ones are the <em>prev + next</em> and <em>prev ~ siblings</em> selectors since if you don't see it is use, you can't really grasp the purpose of them.  I also showed the built in <em>Custom Selectors</em> but did not go into detail with them.</p>
<p>Caching was pretty straight forward so there was not much explanation needed for that.</p>
<p>Finally I jumped in to Traversing, focusing the methods I mentioned above.  The  <em>.is(), .hasClass()</em> and <em>.not()</em> methods were pretty easy to explain, but for the family methods I actually had to show a family, my family.  I created a family tree for the group to better demonstrate  <em>.children()</em>, <em>.parent()</em>, <em>.parents()</em>, <em>.siblings()</em>.  I think it went over pretty well, I think for ease, I will put this grab in between each of the family method slides.  Moving back and forth between slides was a bit time consuming.</p>
<p>Explaining the <em>.next()</em> and <em>.prev()</em> methods was pretty easy and straight forward, there were some questions, but mainly because I was using a bad term, can't remember what it was now.</p>
<p>To demonstrate .end(), I pulled up a few pieces of code from projects that I've been working on and explained what each line was doing, much like what I did for the "<a href="http://benjaminsterling.com/slide-in-tab-window-using-jquery/">Slide in tab</a>" post I did a few weeks back.</p>
<h3>The Close</h3>
<p>There really was not a ton of questions thrown my way, that could mean that I did an excellent job of explaining myself or it means people were totally confused and felt I could not help them.   For the questions that were asked, I was able to answer them pretty easily.</p>
<h3>My thoughts</h3>
<p>There are obviously a few things I feel I need to work on and will try to do so.  I want to do some more talks, maybe focusing on the same topic at first till I feel that one is working the way I want and then maybe move on to more complicated jQuery topics.</p>
<p>The slide show I used for my presentation is below, feel free to have a look at it and let me know your thoughts.  <del datetime="2008-11-25T17:46:47+00:00">As soon as slideshare is done processing it I will post the slideshare link here, till then feel free to check out the presentation via 280slides.</del></p>
<h3>The Slides</h3>
<p><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=gettingyourfeetwetwithjquery2-1227634332338868-8&#038;stripped_title=getting-your-feet-wet-with-jquery2-presentation" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=gettingyourfeetwetwithjquery2-1227634332338868-8&#038;stripped_title=getting-your-feet-wet-with-jquery2-presentation" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/web-tech-november-meetup-presentation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slide in tab window using jQuery</title>
		<link>http://benjaminsterling.com/slide-in-tab-window-using-jquery/</link>
		<comments>http://benjaminsterling.com/slide-in-tab-window-using-jquery/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 04:03:16 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=104</guid>
		<description><![CDATA[Say you want to wanted to put little tabs - you know, the ones like what you get from a lawyer or a realestate again to point out important things - off the side of your page so that your users can click, bring that tab into view to see what important information you want [...]]]></description>
			<content:encoded><![CDATA[<p>Say you want to wanted to put little tabs - you know, the ones like what you get from a lawyer or a realestate again to point out important things - off the side of your page so that your users can click, bring that tab into view to see what important information you want to point out.  Yeah, I know, you've seen these "tabs" a millions times and that is fine, but you have not seen it from my site and most likely you were not secretly brainwashed into learning about other jQuery methods that you don't already use or know about.</p>
<p>So, let the <span style="text-decoration: line-through;">brainwashing</span> education begin!</p>
<h3>The Tabs</h3>
<p><del datetime="2008-11-20T16:39:56+00:00">Take a look off to the left</del> I moved the <a href="http://www.benjaminsterling.com/wp-content/files/sidetab.htm" target="_blank">demo here</a>, do you see the three tabs that are there, they are so spectacularly named "tab 1", "tab2" and, yup you guessed it, "tab3."  The html structure is pretty straight forward:</p>
<div class="igBar"><span id="ljavascript-26"><a href="#" onclick="javascript:showPlainTxt('javascript-26'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-26">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;div id=<span style="color: #3366CC;">"sideTabs"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;div <span style="color: #003366; font-weight: bold;">class</span>=<span style="color: #3366CC;">"tab"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;h3&gt;Tab <span style="color: #CC0000;color:#800000;">1</span>&lt;/h3&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;div <span style="color: #003366; font-weight: bold;">class</span>=<span style="color: #3366CC;">"gut"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;p&gt;Some text&lt;/p&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;div <span style="color: #003366; font-weight: bold;">class</span>=<span style="color: #3366CC;">"tab"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;h3&gt;Tab <span style="color: #CC0000;color:#800000;">2</span>&lt;/h3&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;div <span style="color: #003366; font-weight: bold;">class</span>=<span style="color: #3366CC;">"gut"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;ul&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;li&gt;link&lt;/li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ul&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;div <span style="color: #003366; font-weight: bold;">class</span>=<span style="color: #3366CC;">"tab"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;h3&gt;Tab <span style="color: #CC0000;color:#800000;">3</span>&lt;/h3&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;div <span style="color: #003366; font-weight: bold;">class</span>=<span style="color: #3366CC;">"gut"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;ul&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;li&gt;link&lt;/li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ul&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/div&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You will notice that there are no links for the tabs and this is because we will create them on the fly.  Why?  Well, other then that I have a plan to show you some new tricks, imagine that you have JavaScript turned off, those will just be pointless links with a hash in them.  You can probably argue that we can put an ID with each tab and that link will be a link hash to that ID, and I will say that you are being <span style="text-decoration: line-through;">brainwashed</span> educated to my thinking.</p>
<h3>The CSS</h3>
<p>This part is actually completely open to you to format how ever you want, my initial thought was to do a bunch of "progressive enhancements" - don't you love buzzwords for not truly supporting older browsers - that would entail some gradients, rounded corners and dropshadows, but the point of this post was not to show off my CSS3 prowest.  The point was to show you some fancy methods so here is the CSS I am using:</p>
<div class="igBar"><span id="lcss-27"><a href="#" onclick="javascript:showPlainTxt('css-27'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-27">
<div class="css">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#sideTabs.closed<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">left</span>:-310px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#sideTabs<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">position</span>:<span style="color: #993333;">fixed</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">left</span>:<span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">top</span>:100px;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">width</span>:300px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">height</span>:300px;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border</span>: 10px <span style="color: #993333;">solid</span> #000000;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span>:#fff;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#sideTabs a.tabLinks<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">position</span>:<span style="color: #993333;">absolute</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">right</span>:<span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">top</span>:<span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">outline</span>:<span style="color: #993333;">none</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">display</span>:<span style="color: #993333;">block</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border</span>: 10px <span style="color: #993333;">solid</span> #000000;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; border-width<span style="color: #3333ff;">:1px </span>1px 1px 0px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; -moz-border-radius: 0px 200px 200px 0px;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; -webkit-border-radius: <span style="color: #993333;">none</span> 200px 200px <span style="color: #993333;">none</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">margin</span>:<span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; padding<span style="color: #3333ff;">:<span style="color: #cc66cc;color:#800000;">0</span> </span>5px <span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span>:#000;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">text-decoration</span>:<span style="color: #993333;">none</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font</span>:12px/25px Verdana, Arial, Helvetica, <span style="color: #993333;">sans-serif</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span>:#000;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span>:#fff;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">z-index</span>:<span style="color: #cc66cc;color:#800000;">20</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#sideTabs a.tabLinks.active<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; font<span style="color: #3333ff;">:<span style="color: #993333;">bold</span> </span>14px/25px Verdana, Arial, Helvetica, <span style="color: #993333;">sans-serif</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span>:#fff;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span>:#000;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">z-index</span>:<span style="color: #cc66cc;color:#800000;">21</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>The jQuery</h3>
<p>Alright, we are at the meat and potatoes the corn and the cob the Larry and Moe (and Curly)... sadly that is the best I can do with those analogies.  Any who, we are at the JavaScript, what I will do is post the code and the try to explain what is happening line by line:</p>
<div class="igBar"><span id="ljavascript-28"><a href="#" onclick="javascript:showPlainTxt('javascript-28'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-28">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> jqsideTabs;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> tabs, h = <span style="color: #CC0000;color:#800000;">50</span>, r = <span style="color: #CC0000;color:#800000;">0</span>,ra = <span style="color: #CC0000;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span>document<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">ready</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; jqsideTabs = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#sideTabs'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'closed'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; tabs = jqsideTabs</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'.tab h3'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">clone</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">appendTo</span><span style="color: #66cc66;">&#40;</span>jqsideTabs<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> that = $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>, cls = <span style="color: #3366CC;">''</span>,ow,newThis, newEl;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> i == <span style="color: #CC0000;color:#800000;">0</span> <span style="color: #66cc66;">&#41;</span> cls = <span style="color: #3366CC;">' active'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; newEl = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'&lt;a href=&quot;#&quot; class=&quot;tabLinks'</span>+cls+<span style="color: #3366CC;">'&quot;&gt;'</span> + that.<span style="color: #006600;">text</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #3366CC;">'&lt;/a&gt;'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; that.<span style="color: #006600;">replaceWith</span><span style="color: #66cc66;">&#40;</span>newEl<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; ow = newEl.<span style="color: #006600;">outerWidth</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> i == <span style="color: #CC0000;color:#800000;">0</span> <span style="color: #66cc66;">&#41;</span> ra = ow;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">else</span> r = ow;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; h = newEl.<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span><span style="color: #3366CC;">'top'</span>:h , <span style="color: #3366CC;">'right'</span>: -ow <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">height</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> + h;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; newThis = newEl.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; newThis.<span style="color: #006600;">jq</span> = newEl;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; newThis.<span style="color: #006600;">i</span> = i;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; newEl.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> el = <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">jq</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> jqsideTabs.<span style="color: #006600;">hasClass</span><span style="color: #66cc66;">&#40;</span> <span style="color: #3366CC;">'closed'</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jqsideTabs.<span style="color: #006600;">removeClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'closed'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> !jqsideTabs.<span style="color: #006600;">hasClass</span><span style="color: #66cc66;">&#40;</span> <span style="color: #3366CC;">'closed'</span> <span style="color: #66cc66;">&#41;</span> &amp;&amp; el.<span style="color: #006600;">hasClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jqsideTabs.<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'closed'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; el</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">siblings</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">removeClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span><span style="color: #3366CC;">'right'</span>: -r <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span><span style="color: #3366CC;">'right'</span>: -ra <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tabs.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">i</span> <span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">siblings</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'.tab'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">hide</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">filter</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">':not(:eq(0))'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">hide</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; jqsideTabs.<span style="color: #006600;">bind</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"mouseleave"</span>,<span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; jqsideTabs</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">animate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>left:-<span style="color: #CC0000;color:#800000;">310</span><span style="color: #66cc66;">&#125;</span>, <span style="color: #3366CC;">'fast'</span>, <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jqsideTabs.<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'closed'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">removeAttr</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'style'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
<strong>Update:</strong> <a href="http://www.benjaminsterling.com/wp-content/files/sidetab.htm" target="_blank">Moved the demo to a separate page.</a></p>
<h3>The Explanation</h3>
<p>Lines 1 and 2 are just some variables that I will be setting and reusing through-out the code.</p>
<p>Line 5 I set the "jqsideTabs" variable to reference the jQuery object for the element with an ID of sideTabs and I also add a class of "close".</p>
<p>Line 7 a reference is being set and I will point a little later below what that is actually being referenced too.</p>
<p>Line 8 we look inside the jqsideTabs DIV for the H3 elements that are inside the ".tab" DIVs.  I can just as easily do jqsideTabs.find('.tab &gt; h3') to make sure to the H3 tag directly below the ".tab" element or jqsideTabs.find('.tab h3<a href="http://docs.jquery.com/Selectors/firstChild" target="_blank">:first-child</a>') to make sure I grabbing the first H3 that is the first element under '.tab'.</p>
<p>Line 9 we <a href="http://docs.jquery.com/Manipulation/clone" target="_blank">clone()</a> those H3 elements, if we do <a href="http://docs.jquery.com/Manipulation/clone#true" target="_blank">.clone(true)</a> we will also clone any events that are bound to the H3.</p>
<p>Line 10 we append the cloned H3s to "jqsideTabs"</p>
<p>Line 11 through to 51 we are looping through those H3s to do some fanciness.  Notice the "i" in the function?  That will be returning the index of the loop starting at zero (0).</p>
<p>Line 12 some variables are set up.</p>
<p>Line 14 we check if we are on the first index, which is zero (0), and then set the "cls" variable to "active".</p>
<p>Line 15 we set up a reference to a new DOM element/jQuery object that has the text of the H3 element by using "that<a href="http://docs.jquery.com/Attributes/text" target="_blank">.text()</a>".</p>
<p>Line 16 we replace the H3 with the newly create DOM element, the A element/tag/</p>
<p>Line 18 we get the outer width (<a href="http://docs.jquery.com/CSS/outerWidth#options" target="_blank">.outerWidth()</a>) of the element, outerWidth() will get the full width of the element including border and padding, if you were to do outerWidth(true) you would also get the margins.</p>
<p>Line 20 we check if it is the first index again and if so, set the variable "ra" to the outer width</p>
<p>Line 21 is the else part of line 20 and here we set the "r" variable.  Both "ra" and "r" will be used for "right active" and "right".  You will see their purpose shortly.</p>
<p>Line 23 is doing a few things, 1) it is setting the top and right positions of the element and returning the <a href="http://docs.jquery.com/CSS/height" target="_blank">.height()</a> of the element plus the previously stored height at the same time.</p>
<p>Line 25 we are using the <a href="http://docs.jquery.com/Core/get#index" target="_blank">.get(0)</a> method against the newly created A tag and this will give us the equivalent of doing a getElementById.</p>
<p>Line 26 we set the reference now so that we don't have to re-look up this element later on, the speed gain is probably minimum at best but I makes me happy to do this and really, that is what it's all about.</p>
<p>Line 27 and line 26 we are doing something specific and really can't remember what it is called, maybe "assignment," but basically we are storing some data directly in the DOM to be used later.</p>
<p>Line 29 we add a <a href="http://docs.jquery.com/Events/click#fn" target="_blank">.click()</a> event to the A tag we created.</p>
<p>Line 30 just to stick to a decent naming conventions I take the varariable I set earlier and plop it into a new variable call "el" (short for element)</p>
<p>Line 32 to 34 we check to see if the jqsideTabs element has a class (<a href="http://docs.jquery.com/Traversing/hasClass#class" target="_blank">.hasClass()</a>) of "closed", if so, remove that class.</p>
<p>Line 35 to 37 we check to see if the jqsidetabs element <strong>does not have</strong> a class of "closed" and the current element has a class of "active", if so, add the class "close".</p>
<p>Line 40 we grab all the <a href="http://docs.jquery.com/Traversing/siblings#expr" target="_blank">.siblings()</a>, in this case, all the .tab DIVs and links that were created.</p>
<p>Line 41 each item returns will have the class "active" removed.</p>
<p>Line 42 the default right position is set for those elements.  But let me note something real quick, in this case I am going with the assumption that I did not set the "position" of the .tab elements to anything, meaning, they were not set to relative or absolute.  If I did this I would need to change siblings to only grab items at are A tags to be sure I only grab the, well, A tags.</p>
<p>Line 43 the <a href="http://docs.jquery.com/Traversing/end" target="_blank">.end()</a> method is used, this brings the reference back to "el" at line 39.</p>
<p>Line 44 a class of "active" is added.</p>
<p>Line 45 the right position is set to the "ra" variable.</p>
<p>Line 47 with the reference of tabs that was set back at line 7, we find the DIV or .tab that equals what ever that index (i) is match to, in the example it can be either 0, 1 or 2, then we show that one and then hide its siblings that have a class of ".tab".</p>
<p>Line 49 a return of false is used to stop the default action of the link.</p>
<p>Line 52 end() is used to give reference back to the H3 tags.</p>
<p>Line 53 we use <a href="http://docs.jquery.com/Traversing/parent#expr" target="_blank">.parent()</a> to grab the parents of the H3 tags.</p>
<p>Line 54 we filter down to the first element in the parents by using .eq(0).</p>
<p>Line 55 a class is added to that returned element from line 54.</p>
<p>Line 56 we go back to all the parents by using .end()</p>
<p>Line 57 filter is used with the combination seletor of "<a href="http://docs.jquery.com/Selectors/not#selector" target="_blank">:not()</a>" and ":eq(0)" to grab all the DIVs (the parents of the H3s) that is not equal to the first one.</p>
<p>Line 58 then we hide the returned elements</p>
<p>Line 59 here we use end() to finally set the "tabs" variable that we have way back at line 7.</p>
<h3>The Closing</h3>
<p>Ok, are you <span style="text-decoration: line-through;">brainwashed</span> educated yet?  Could I have combined a few steps or could I have writen some of my selectors to be a little more precise? Sure I could have.  The beauty of coding with jQuery is that there can be any number of ways to approach the same exact issue.  But do keep in mind that my way is always the right way.</p>
<p>But seriously, there are a lot of ways to use the jQuery framework, you have to find the way the best suits you.  And the only way to find that out is to learn how others do it and read the docs and learn the <a href="http://docs.jquery.com/Selectors" target="_blank">selectors</a> and <a href="http://docs.jquery.com/Traversing" target="_blank">traversing</a> methods.</p>
<p>As always, please feel free to check me if I got something incorrect or if you think you can do better.  I am just as open to learning as you should be.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/slide-in-tab-window-using-jquery/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Better jQuery Code #2</title>
		<link>http://benjaminsterling.com/better-jquery-code-2/</link>
		<comments>http://benjaminsterling.com/better-jquery-code-2/#comments</comments>
		<pubDate>Sun, 16 Nov 2008 16:00:17 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=101</guid>
		<description><![CDATA[In a follow up to my Better jQuery Code #1 post I will be writing about some other small items that I have found to make my code better and more readable.
Chaining
Chaining is one of the most beautiful and time save pieces of code structure that jQuery brought to the game, the problem is is [...]]]></description>
			<content:encoded><![CDATA[<p>In a follow up to my <a href="http://benjaminsterling.com/better-jquery-code-1/">Better jQuery Code #1</a> post I will be writing about some other small items that I have found to make my code better and more readable.</p>
<h3>Chaining</h3>
<p>Chaining is one of the most beautiful and time save pieces of code structure that jQuery brought to the game, the problem is is that it can make the code unreadable if not treated correctly.</p>
<p>For example, say you wanted to select the fourth LI in your nav and add a class, remove a class from it, then you want to find the UL that is a child of that LI and add a class to that, then want to move back to the UL that has the ID nav on it (.end() goes back to the last 'destructive' operation) and lastly you want to animate that UL.  Along with have a heft run on sentence you also have a pretty unreadable string of functions.</p>
<div class="igBar"><span id="ljavascript-39"><a href="#" onclick="javascript:showPlainTxt('javascript-39'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-39">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#nav'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span>&amp;gt; li<span style="color: #3366CC;">').eq(3).addClass('</span>className<span style="color: #3366CC;">').removeClass('</span>otherClass<span style="color: #3366CC;">').find('</span>ul<span style="color: #3366CC;">').addClass('</span>redClass<span style="color: #3366CC;">').end().end().end().slideUp().slideDown(); </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Instead, format you code to look something like below, you can have more then one methods per line, but keep it reasonable and readable.  See how I am indenting each line?  This is to give it a sense that each method is referring to specific elements.  Much like you would indent your HTML and how some people indent their related CSS, it is good practice to indent your code.</p>
<div class="igBar"><span id="ljavascript-40"><a href="#" onclick="javascript:showPlainTxt('javascript-40'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-40">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#nav'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'&gt; li'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">3</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'className'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">removeClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'otherClass'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'ul'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'redClass'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">slideUp</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">slideDown</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>A small caveat to the above structure is that if you run your code through <a href="http://www.javascriptlint.com/online_lint.php">JavaScript Lint</a> you will get a notice of "lint warning: unexpected end of line; it is ambiguous whether these lines are part of the same statement," I personally don't see an issue with this and will just to a find and replace for the line break and all is good.</p>
<h3>Traversing (Finding)</h3>
<p><a href="http://benjaminsterling.com/better-jquery-code-1/"><br />
Last post I posted about <strong>eq, hasClass, is, and not</strong></a> which are four traversing methods for filtering out certain items from your select.  For returning specific elements from the DOM using the <a href="http://docs.jquery.com/Traversing/children#expr" target="_blank">children()</a>, <a href="http://docs.jquery.com/Traversing/siblings" target="_blank">siblings()</a>, <a href="http://docs.jquery.com/Traversing/parent#expr" target="_blank">parent()</a>, and <a href="http://docs.jquery.com/Traversing/parents#expr" target="_blank">parents()</a> methods in most of my projects.</p>
<blockquote class="quote"><p>The Core developers for jQuery are very smart people</p></blockquote>
<p>The Core developers for jQuery are very smart people, they name methods the make a lot of sense and match up to the functionality they provide and <strong>children()</strong> is not an exception.  Let's assume we have the following DOM structure:</p>
<div class="igBar"><span id="ljavascript-41"><a href="#" onclick="javascript:showPlainTxt('javascript-41'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-41">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;ul id=<span style="color: #3366CC;">"nav"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt;&lt;a&gt;Text&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt;&lt;a&gt;Text&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>li&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt;&lt;a&gt;Text&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt;&lt;a&gt;Text&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>li&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt; &lt;a&gt;Text&lt;/a&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;ul&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt;&lt;a&gt;text&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/ul&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt;&lt;a&gt;Text&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>li&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt;&lt;a&gt;Text&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/ul&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>With that structure, we did:</p>
<div class="igBar"><span id="ljavascript-42"><a href="#" onclick="javascript:showPlainTxt('javascript-42'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-42">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#nav'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">children</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>How many elements would be returned? 17? 15? 7?</p>
<p>If you said 7 then you are correct; why not 17 or 15?  Imagine this, you have a single parent, and you have 6 brothers each of whom have a significant other.  You and your significant other have a daughter and she in turns has a kid but is single and that kid has a childhood sweetheart.  In this scenario "#nav" is your mother (we'll cover the parent and parents method below but keep this in your head) and when we say give me all your children we are only look for your mothers immediate children, which in this case are the LI.</p>
<p>Got that?</p>
<p>Ok, now what do you get if you do the following with the <strong>siblings()</strong> method?</p>
<div class="igBar"><span id="ljavascript-43"><a href="#" onclick="javascript:showPlainTxt('javascript-43'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-43">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li:eq(4)'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">siblings</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>If you said 6, you are correct, siblings will select all your immediate brothers and sisters.  You following me so far?  Does this make sense?  In this example we are saying select the LI that is in the forth index (or in this case, you) and then get my brothers and sisters or siblings.</p>
<p>Just for a teaser, what if you wanted to something to you and your siblings?  Easy, just add<strong> .andSelf()</strong> at the end (this would probably be used in a case where you click on a LI and do $(this)).  We'll cover this a bit more in a later post.</p>
<div class="igBar"><span id="ljavascript-44"><a href="#" onclick="javascript:showPlainTxt('javascript-44'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-44">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li:eq(4)'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">siblings</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">andSelf</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The <strong>.parent()</strong> method is pretty straight forward, it will select your immediate parent.  So in the following case you will select the UL.</p>
<div class="igBar"><span id="ljavascript-45"><a href="#" onclick="javascript:showPlainTxt('javascript-45'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-45">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li:eq(4)'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The <strong>parent() </strong>method excepts an expression but the only need I've ever had was to quickly test the parent for something particular, maybe a class or a specific attribute or attribute with a certain value, in an IF statement. (remember, in JavaScript 0 is treated at false and 1 is treated as true)</p>
<div class="igBar"><span id="ljavascript-46"><a href="#" onclick="javascript:showPlainTxt('javascript-46'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-46">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li:eq(4)'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'.selected'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li:eq(4)'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'[data]'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li:eq(4)'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'[start=5]'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The <strong>parents()</strong> method can be a little more powerful for your needs, but is useful in some cases.  Let's assume that the UL above is the only code in your body tag.  So if you do the following how many items will be returned? 1? 2? 3? 4?</p>
<div class="igBar"><span id="ljavascript-47"><a href="#" onclick="javascript:showPlainTxt('javascript-47'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-47">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li:eq(4)'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">parents</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>If you said anything but 3 you would be incorrect, if the UL code above was the only child of the body tag that the JavaScript code above would return the UL, BODY, and HTML tags.  With the parents method you can filter it down to what you want by using any number of selectors that jQuery supports.</p>
<p>Below is a piece of code from a project I've been working on.  Basically the issue was that there needed to be a submit button appended after the last input box on the page. If that input box is inside of table, append the button after the table.  The issue was, I had not idea what the TABLE may be in, could have been a DIV that is inside of a DIV and so on.  Also keep in mind that as of this writing I see at least one better way to have written out this code but for this post this example should work fine.</p>
<div class="igBar"><span id="ljavascript-48"><a href="#" onclick="javascript:showPlainTxt('javascript-48'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-48">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// inlineTextQuestion is a reference to all the input elements</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> lastOne = inlineTextQuestion.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span> inlineTextQuestion.<span style="color: #006600;">size</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>-<span style="color: #CC0000;color:#800000;">1</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> lastOneParents = lastOne.<span style="color: #006600;">parents</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> lastOneParent = <span style="color: #003366; font-weight: bold;">null</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">lastOneParents</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> lastOneParent === <span style="color: #003366; font-weight: bold;">null</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> el = $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// #bodyText is the one known factor I had</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> el.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #000066; font-weight: bold;">is</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#bodyText'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lastOneParent = el;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// sbmt is a reference to a submit button create about this code</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">lastOneParent.<span style="color: #006600;">after</span><span style="color: #66cc66;">&#40;</span>sbmt<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Let me try to explain what is going on, please refer to the comments in the code for what the variables are reference to, line 2 I am grabbing a reference to the last INPUT in the inlineTextQuestion variable.  Line 3 I grabbed a reference to the all the parents of that INPUT.  Line 6/7 I loop through all the parents checking , at line 11, to see if the current element's parent is the DIV with the ID of "bodyText."  If that returns true we set a reference to that element and at line 18 I append the submit button after that referenced element.</p>
<h3>Closing</h3>
<p>In this post we discussed using the <a href="http://docs.jquery.com/Traversing/children#expr" target="_blank">children()</a>, <a href="http://docs.jquery.com/Traversing/siblings" target="_blank">siblings()</a>, <a href="http://docs.jquery.com/Traversing/parent#expr" target="_blank">parent()</a>, and <a href="http://docs.jquery.com/Traversing/parents#expr" target="_blank">parents()</a> methods and I try to explain them the way I see them.  These are the ones I use the most and the ones I think you will find the love for.</p>
<p>If there is anything with the above you don't under stand or, god forbid, I got incorrect, please feel free to drop me a line.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/better-jquery-code-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Better jQuery Code #1</title>
		<link>http://benjaminsterling.com/better-jquery-code-1/</link>
		<comments>http://benjaminsterling.com/better-jquery-code-1/#comments</comments>
		<pubDate>Sat, 15 Nov 2008 18:01:50 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=99</guid>
		<description><![CDATA[

I've been wanting to write some jQuery tips for a while now and just never know what to really say until I saw Marc Grabanski's 5 Tips for Better jQuery Code.  Although I have tips, I don't think I have any that are Earth shattering or ones that I can rank higher then the other, [...]]]></description>
			<content:encoded><![CDATA[<div class="featureImg"><img class="alignnone size-full wp-image-100" title="jquery_logo_color_onwhite" src="http://benjaminsterling.com/wp-content/uploads/2008/11/jquery_logo_color_onwhite.png" alt="" width="610" /></div>
<p><br/></p>
<p>I've been wanting to write some jQuery tips for a while now and just never know what to really say until I saw <a title="5 Tips for Better jQuery Code" href="http://marcgrabanski.com/article/5-tips-for-better-jquery-code" target="_blank">Marc Grabanski's 5 Tips for Better jQuery Code</a>.  Although I have tips, I don't think I have any that are Earth shattering or ones that I can rank higher then the other, but these are ones that I use daily and are asked about just as often.</p>
<h3>Caching</h3>
<p>If there are items you will be referencing more than once, cache it!  Even if you won't be referencing an item more than once still get in the habit of setting up references.</p>
<p>Now, what do I mean references?  If you are going to be playing with you main nav group or probably going to be messing with inputs, set up a variable and store the reference to those element in it.</p>
<div class="igBar"><span id="ljavascript-57"><a href="#" onclick="javascript:showPlainTxt('javascript-57'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-57">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> mainNav = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#main_nav a'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> inputs = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'input'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// the make calls like</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mainNav.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">input.<span style="color: #006600;">change</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>[Update #1: as <a href="http://benjaminsterling.com/better-jquery-code-1/#comment-5149">Sean O</a> points out, doing $mainNav may help you remember that the variable is a jQuery object and may be good practice.]</p>
<p>[Update #2: Another good point from <a href="http://benjaminsterling.com/better-jquery-code-1/#comment-5151">Dan G. Switzer</a>, you could easily have cached your jQuery objects when you initiated your events/behaviors like below]</p>
<div class="igBar"><span id="ljavascript-58"><a href="#" onclick="javascript:showPlainTxt('javascript-58'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-58">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> $mainNav = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#mainNav'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>Traversing (Filtering)</h3>
<p>This is a topic I plan to put some more effort into in a later post but there are four methods you should use: <strong><a href="http://docs.jquery.com/Traversing/eq#index" target="_blank">eq</a>, <a href="http://docs.jquery.com/Traversing/hasClass#class" target="_blank">hasClass</a>, <a href="http://docs.jquery.com/Traversing/is#expr" target="_blank">is</a>, and <a href="http://docs.jquery.com/Traversing/not#expr" target="_blank">not</a></strong>.</p>
<p>The use of these methods will filter out your selection to mat</p>
<div class="igBar"><span id="ljavascript-59"><a href="#" onclick="javascript:showPlainTxt('javascript-59'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-59">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> mainNav = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#main_nav a'</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>eq()</strong> will filter your selection down to one element <strong>eq(1)</strong> will select the second element since the jQuery object that is returned by $('#main_nav a') is basically a zero based array.</p>
<div class="igBar"><span id="ljavascript-60"><a href="#" onclick="javascript:showPlainTxt('javascript-60'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-60">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mainNav.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>A combination of <strong>eq </strong>and <strong>hasClass</strong>; <strong>hasClass </strong>is exacly what it sounds like, it checks the element to see if it has a class of "selected" and returns true if it does have that class</p>
<div class="igBar"><span id="ljavascript-61"><a href="#" onclick="javascript:showPlainTxt('javascript-61'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-61">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mainNav.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">hasClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'selected'</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Once again, a combination of <strong>eq </strong>and <strong>is</strong>; <strong>is </strong>simply checks the element in question against the expression in the brackets and returns true if is has the class selected or if the tag is A</p>
<div class="igBar"><span id="ljavascript-62"><a href="#" onclick="javascript:showPlainTxt('javascript-62'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-62">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mainNav.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #000066; font-weight: bold;">is</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'.selected'</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #009900; font-style: italic;">// checks for class of selected</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mainNav.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #000066; font-weight: bold;">is</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'a'</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #009900; font-style: italic;">// checks to see element is an A tag </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Checks to see if element has text in it of "special text" returns true if it has that text</p>
<div class="igBar"><span id="ljavascript-63"><a href="#" onclick="javascript:showPlainTxt('javascript-63'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-63">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mainNav.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #000066; font-weight: bold;">is</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">':contains(special text)'</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>.not()</strong> will return elements that do <strong>not</strong> match the expression.</p>
<div class="igBar"><span id="ljavascript-64"><a href="#" onclick="javascript:showPlainTxt('javascript-64'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-64">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mainNav.<span style="color: #006600;">not</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'.active'</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>So if you were to put a class of active on one of the links, that call will return all links in mainNav that you did <strong>not </strong>put a class of active.</p>
<h3>Closing</h3>
<p>Ok, I wanted to keep this short and point out some of the items I personally deal with and some items that I get asked about daily.  There are a few other items that I will address in another post that will make your life easier.</p>
<p>If there is anything with the above you don't under stand or, god forbid, I got incorrect, please feel free to drop me a line.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/better-jquery-code-1/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Release of jQuery UI v1.5</title>
		<link>http://benjaminsterling.com/release-of-jquery-ui-v15/</link>
		<comments>http://benjaminsterling.com/release-of-jquery-ui-v15/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 14:28:44 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=67</guid>
		<description><![CDATA[Well ladies and gents, it is finally here!  Mark June 9th, 2008 as the day the web got better, jQuery's long awaited release of it's UI library update is here.  Flushed with many bug fixes, a bunch of really good examples, many new features and a theme builder.
When jQuery UI first came out [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://benjaminsterling.com/wp-content/uploads/2008/06/jquer.jpg"><img class="alignleft size-medium wp-image-70" style="float: left;margin:0 1em 1em 0;" title="jquer" src="http://benjaminsterling.com/wp-content/uploads/2008/06/jquer-300x239.jpg" alt="" width="300" height="239" /></a>Well ladies and gents, it is finally here!  Mark June 9th, 2008 as the day the web got better, jQuery's long awaited release of it's UI library update is here.  Flushed with many <a href="http://ui.jquery.com/bugs">bug fixes</a>, a bunch of really <a href="http://ui.jquery.com/demos">good examples</a>, many <a href="http://docs.google.com/Doc?id=dcm3h3vx_3c844cghh">new features</a> and a <a href="http://ui.jquery.com/themeroller">theme builder</a>.</p>
<p>When jQuery UI first came out it was huge, but with as huge as it was the list of issues with it were also pretty big.  The months since it's initial release the <a href="http://ui.jquery.com/about">UI developers</a> have been working tirelessly to squash these bugs and add better cross browser support for IE 6.0+, FF 2+, Safari 3.1+, Opera 9.0+.</p>
<p>The problem I have had in the past is envisioning just what a library can do and now with the new release you can see some really good examples of what jQuery UI can do.  You need the initial structure to build an image cropper?  How about an image manager with drag and drop capabilities?  You like the Apple slider gallery and you want it for yourself?  All these and more are now available for your consumption.</p>
<p>At the same time they were able to merge in the jQuery Enchant library which was a library to compete with Scriptaculous.  Scriptaculous has always provided great effects to Prototype users; something jQuery was lacking and consistently was one of the issues brought up about jQuery.  With having Enchant merged into jQuery UI the proverbial playing field is now level.</p>
<p><a href="http://benjaminsterling.com/wp-content/uploads/2008/06/jquery-themeroller.jpg"><img class="alignleft size-thumbnail wp-image-69" style="float: right;margin:0 0 1em 1em" title="jquery-themeroller" src="http://benjaminsterling.com/wp-content/uploads/2008/06/jquery-themeroller-150x150.jpg" alt="" width="150" height="150" /></a>But since jQuery is not one to sit on its hands, they took it a bit further - with the help of <a href="http://www.filamentgroup.com/">Filament Group in Boston</a> - and developed a <a href="http://ui.jquery.com/themeroller">theme builder</a>.  If you are like me this is huge; trying to got thru the code to make changes to a component to get it to look like the design I am working on can be a pain.  With the theme build you simple select the colors and style you want, click the "Download This Theme" link and you are on your way.</p>
<p>All in all the jQuery UI team have been very very busy and have really done a great job with this release.  I want to send out a personal thank you to the jQuery and jQuery UI developments teams for the hard work they put in to the jQuery and jQuery UI libraries.  I also want to put a thank you out there for the <a href="http://www.filamentgroup.com/">Filament Group in Boston</a> and <a href="http://www.liferay.com/web/guest/home">LIFERAY</a> for their support and contributions to the jQuery community.  It is really great that they stepped up and helped make something good great!</p>
<p>Full release notes can be found at the <a href="http://jquery.com/blog/2008/06/09/jquery-ui-v15-released-focus-on-consistent-api-and-effects/">jQuery blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/release-of-jquery-ui-v15/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Baltimore Refresh jQuery Presentation</title>
		<link>http://benjaminsterling.com/baltimore-refresh-jquery-presentation/</link>
		<comments>http://benjaminsterling.com/baltimore-refresh-jquery-presentation/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 12:12:37 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Refresh Baltimore]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=64</guid>
		<description><![CDATA[<img src="/wp-content/themes/sterling/common/img/icon_jquery.jpg" class="excerptImg"/>On April 9th I had given a jQuery Presentation on the basics of using jQuery and how to punch up your site with some minor animations.  All in all the presentation went over well and I got a lot of good questions.  Since my days at UPS I've never been real good at creating Power Points to give my presentations.  I've always been better at just showing, planning what I want to talk about and then just letting the presentation flow.  Which can be good and bad depending on if the crowd asks questions.  With that said, I did not create any Power Points slided, but since a got a good amount of emails asking me to post them, I decided to just create a screencast that covers everything we went over, answering the questions that were asked during the presentation.]]></description>
			<content:encoded><![CDATA[<p>On April 9th I had given a jQuery Presentation on the basics of using jQuery and how to punch up your site with some minor animations.  All in all the presentation went over well and I got a lot of good questions.  Since my days at UPS I've never been real good at creating Power Points to give my presentations.  I've always been better at just showing, planning what I want to talk about and then just letting the presentation flow.  Which can be good and bad depending on if the crowd asks questions.  With that said, I did not create any Power Points slided, but since a got a good amount of emails asking me to post them, I decided to just create a screencast that covers everything we went over, answering the questions that were asked during the presentation.</p>
<p>So without rambling on anymore, here is the presentation screencast.</p>
<p><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="437" height="370" id="viddler_kenzomedia_4"><param name="movie" value="http://www.viddler.com/player/38d4d6b3/" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><embed src="http://www.viddler.com/player/38d4d6b3/" width="437" height="370" type="application/x-shockwave-flash" allowScriptAccess="always" allowFullScreen="true" name="viddler_kenzomedia_4" ></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/baltimore-refresh-jquery-presentation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Create an unobtrusive photo gallery</title>
		<link>http://benjaminsterling.com/create-an-unobtrusive-photo-gallery/</link>
		<comments>http://benjaminsterling.com/create-an-unobtrusive-photo-gallery/#comments</comments>
		<pubDate>Sat, 05 Apr 2008 04:00:54 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Photogallery]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[accessible]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[image / photo galleries]]></category>
		<category><![CDATA[image gallery]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery Plugin]]></category>
		<category><![CDATA[photo gallery]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[unobtrusive]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/create-an-unobtrusive-photo-gallery/</guid>
		<description><![CDATA[<img src="/wp-content/themes/sterling/common/img/icon_jquery.jpg" class="excerptImg"/>As you very well know by now, I have created quite a few image / photo galleries and the ultimate goal was to allow them to be as unobtrusive as possible.  Well, the other day I got into a discussion with a co-worker and the questions he asked were, "How is that unobtrusive?", referring to my gallery plugins, "The images are in list elements?"  My answer to that was, "They can be styled to have each list element float and punched up a bit."  His rebuttal, "But what if styles were off also?"  I hesitated for a second and he know he had won this conversation and silently walked away.]]></description>
			<content:encoded><![CDATA[<p>As you very well know by now, I have created quite a few  and the ultimate goal was to allow them to be as unobtrusive as possible.  Well, the other day I got into a discussion with a co-worker and the questions he asked were, "How is that unobtrusive?", referring to my  , "The images are in list elements?"  My answer to that was, "They can be styled to have each list element float and punched up a bit."  His rebuttal, "But what if styles were off also?"  I hesitated for a second and he knew he had won this conversation and silently walked away.</p>
<h3>The purpose</h3>
<p>So the purpose of this post is a) show you how to build an unobtrusive image gallery or photo gallery, how ever you want to say it, and b) show you have to create a jQuery plugin.</p>
<h3>Step 1</h3>
<p>So what I am going to do here is show you have to create an unobtrusive image /  using a, "gasp," table.  Why a table?  Tables are so 1.0?  Well, the definition of  basically breaks down to, if the user has JavaScript AND CSS off, the gallery should still work and be laid out as planned.</p>
<p>Below is the structure we are going to start of with; nothing fancy, just old fashion html.  Each image sites in a cell of the table which we can control the basic look by adjusting the cellpadding or cellspacing attributes.</p>
<div class="igBar"><span id="lhtml-65"><a href="#" onclick="javascript:showPlainTxt('html-65'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-65">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">&lt;table</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"theGallery"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"1"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/caption.html"><span style="color: #000000; font-weight: bold;">&lt;caption&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; The Gallery</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/caption&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/tbody.html"><span style="color: #000000; font-weight: bold;">&lt;tbody&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">&lt;tr&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh6.google.com/sterling.benjamin/RuyW_7tKn8I/AAAAAAAAAVc/opzOXldgJ0Y/DSC_0001.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh6.google.com/sterling.benjamin/RuyW_7tKn8I/AAAAAAAAAVc/opzOXldgJ0Y/s72/DSC_0001.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"Yes, I do know what I am doing!"</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"72"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"48"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh5.google.com/sterling.benjamin/RuyYPrtKn9I/AAAAAAAAAWE/Y1kITpSTFXI/DSC_0025.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh5.google.com/sterling.benjamin/RuyYPrtKn9I/AAAAAAAAAWE/Y1kITpSTFXI/s72/DSC_0025.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"Hey, it is better then reversible diapers!"</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"72"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"48"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh6.google.com/sterling.benjamin/RuyYQ7tKn-I/AAAAAAAAAWM/PHN5lywzjbU/100_1712.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh6.google.com/sterling.benjamin/RuyYQ7tKn-I/AAAAAAAAAWM/PHN5lywzjbU/s72/100_1712.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"It... it smells like... old cheese in here..."</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"72"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"54"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh6.google.com/sterling.benjamin/RuyYR7tKn_I/AAAAAAAAAWU/bJ-HZwkTyKg/100_1886.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh6.google.com/sterling.benjamin/RuyYR7tKn_I/AAAAAAAAAWU/bJ-HZwkTyKg/s72/100_1886.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"Everyone looks good through a glass of beer!"</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"72"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"54"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh4.google.com/sterling.benjamin/RuyZObtKoAI/AAAAAAAAAWc/dDMbJK0jSlw/DSC_0004.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh4.google.com/sterling.benjamin/RuyZObtKoAI/AAAAAAAAAWc/dDMbJK0jSlw/s72/DSC_0004.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"Sample Text"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">&lt;tr&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh6.google.com/sterling.benjamin/RuyZa7tKoBI/AAAAAAAAAWo/dmnMNJS2nPI/DSC_0005.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh6.google.com/sterling.benjamin/RuyZa7tKoBI/AAAAAAAAAWo/dmnMNJS2nPI/s72/DSC_0005.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"Sample text"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh3.google.com/sterling.benjamin/RuyZnLtKoCI/AAAAAAAAAWw/1TD-_nNT8PA/DSC_0006.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh3.google.com/sterling.benjamin/RuyZnLtKoCI/AAAAAAAAAWw/1TD-_nNT8PA/s72/DSC_0006.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"Sample text"</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"72"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"48"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh5.google.com/sterling.benjamin/RuyZ2rtKoDI/AAAAAAAAAW8/qo9vOy-0mcI/DSC_0012.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh5.google.com/sterling.benjamin/RuyZ2rtKoDI/AAAAAAAAAW8/qo9vOy-0mcI/s72/DSC_0012.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"Is he going to eat me?!"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh6.google.com/sterling.benjamin/RuyaB7tKoEI/AAAAAAAAAXE/Yt124tfI_WU/DSC_0030.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh6.google.com/sterling.benjamin/RuyaB7tKoEI/AAAAAAAAAXE/Yt124tfI_WU/s72/DSC_0030.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"Sample text"</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"72"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"48"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh4.google.com/sterling.benjamin/RuyajbtKoFI/AAAAAAAAAXQ/QfKtfA6yEwE/DSC_0055.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh4.google.com/sterling.benjamin/RuyajbtKoFI/AAAAAAAAAXQ/QfKtfA6yEwE/s72/DSC_0055.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"It's like talking to a wall!!!"</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"72"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"48"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">&lt;tr&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh5.google.com/sterling.benjamin/RuyaurtKoGI/AAAAAAAAAXY/t_ASBQcH07k/DSC_0047.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh5.google.com/sterling.benjamin/RuyaurtKoGI/AAAAAAAAAXY/t_ASBQcH07k/s72/DSC_0047.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"Sample text"</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"72"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"48"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh6.google.com/sterling.benjamin/Ruya87tKoHI/AAAAAAAAAXk/LJZOZR7RmSU/DSC_0032.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh6.google.com/sterling.benjamin/Ruya87tKoHI/AAAAAAAAAXk/LJZOZR7RmSU/s72/DSC_0032.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"Sample text"</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"72"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"48"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh4.google.com/sterling.benjamin/RuybGbtKoII/AAAAAAAAAXs/dBiWzDZfWas/DSC_0033.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh4.google.com/sterling.benjamin/RuybGbtKoII/AAAAAAAAAXs/dBiWzDZfWas/s72/DSC_0033.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"This is my seductive look! It works on all the boys."</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"72"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"48"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh3.google.com/sterling.benjamin/RuybSLtKoJI/AAAAAAAAAX4/btmxxtIcX5I/DSC_0020.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh3.google.com/sterling.benjamin/RuybSLtKoJI/AAAAAAAAAX4/btmxxtIcX5I/s72/DSC_0020.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"Sample text"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh5.google.com/sterling.benjamin/RuybertKoKI/AAAAAAAAAYA/Tay8MWRdwrM/DSC_0021.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh5.google.com/sterling.benjamin/RuybertKoKI/AAAAAAAAAYA/Tay8MWRdwrM/s72/DSC_0021.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"Sample text"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">&lt;tr&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh3.google.com/sterling.benjamin/Ruyd3LtKoLI/AAAAAAAAAYM/lOMruypZVd0/DSC_0017.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh3.google.com/sterling.benjamin/Ruyd3LtKoLI/AAAAAAAAAYM/lOMruypZVd0/s72/DSC_0017.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"Sample text"</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"72"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"48"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh5.google.com/sterling.benjamin/RuyghrtKoMI/AAAAAAAAAYs/KeOhIMfMrSc/DSC_0024.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh5.google.com/sterling.benjamin/RuyghrtKoMI/AAAAAAAAAYs/KeOhIMfMrSc/s72/DSC_0024.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"You won't like me when I'm angry!"</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"72"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"48"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh5.google.com/sterling.benjamin/RuygrrtKoRI/AAAAAAAAAZY/KBrh0d_jECY/DSC_0018.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh5.google.com/sterling.benjamin/RuygrrtKoRI/AAAAAAAAAZY/KBrh0d_jECY/s72/DSC_0018.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"Sample text"</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"72"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"48"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh4.google.com/sterling.benjamin/RuygtbtKoSI/AAAAAAAAAZg/99k8UFMs7zU/DSC_0021.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh4.google.com/sterling.benjamin/RuygtbtKoSI/AAAAAAAAAZg/99k8UFMs7zU/s72/DSC_0021.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"It is out of focus; let me help."</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"72"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"48"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh4.google.com/sterling.benjamin/RuygxbtKoUI/AAAAAAAAAZw/Htm20GnEPKs/DSC_0007.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh4.google.com/sterling.benjamin/RuygxbtKoUI/AAAAAAAAAZw/Htm20GnEPKs/s72/DSC_0007.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"I always have to carry the conversation; they never say anything."</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"72"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"48"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">&lt;tr&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh6.google.com/sterling.benjamin/Ruygy7tKoVI/AAAAAAAAAZ4/ShwLc51HYjQ/DSC_0002.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh6.google.com/sterling.benjamin/Ruygy7tKoVI/AAAAAAAAAZ4/ShwLc51HYjQ/s72/DSC_0002.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"Sample text"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh4.google.com/sterling.benjamin/RuyhzbtKocI/AAAAAAAAAa0/lcEfHJtN67c/DSC_0096.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh4.google.com/sterling.benjamin/RuyhzbtKocI/AAAAAAAAAa0/lcEfHJtN67c/s72/DSC_0096.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"Sample text"</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"72"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"48"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh5.google.com/sterling.benjamin/Ruyg6rtKoaI/AAAAAAAAAak/LJmQ1uFC3Y4/DSC_0010.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh5.google.com/sterling.benjamin/Ruyg6rtKoaI/AAAAAAAAAak/LJmQ1uFC3Y4/s72/DSC_0010.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"Sample text"</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"72"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"48"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh5.google.com/sterling.benjamin/RuyiPrtKomI/AAAAAAAAAcM/o7St6jYPLEw/DSC_0039.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh5.google.com/sterling.benjamin/RuyiPrtKomI/AAAAAAAAAcM/o7St6jYPLEw/s72/DSC_0039.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"Sample text"</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"72"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"48"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://lh6.google.com/sterling.benjamin/RuykW7tKo0I/AAAAAAAAAeA/Xuw9LFqcfQ4/DSC_0126.JPG?imgmax=800"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://lh6.google.com/sterling.benjamin/RuykW7tKo0I/AAAAAAAAAeA/Xuw9LFqcfQ4/s72/DSC_0126.JPG"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"I SAID CLOSER!!!"</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"72"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"48"</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tbody&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/table&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><a href="/gallery-example-1/" target="_blank" rel="nofollow">Current progress</a></p>
<p>I am using the caption element to give the gallery a title, you could have simply done the below as well:</p>
<div class="igBar"><span id="lhtml-66"><a href="#" onclick="javascript:showPlainTxt('html-66'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-66">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/thead.html"><span style="color: #000000; font-weight: bold;">&lt;thead&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">&lt;tr&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/th.html"><span style="color: #000000; font-weight: bold;">&lt;th</span></a> <span style="color: #000066;">colspan</span>=<span style="color: #ff0000;">"5"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>The Gallery<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/th&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/thead&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>Step 3: The Style</h3>
<p>Since we are planning for this gallery to still look good if JavaScript is turned off, we are going to need to give it some style, make it pretty.  At this point, you are only limited by your imagination and, well IE 6, but that should never hold you back.  That is another topic for another day.</p>
<p>We are going to keep it simple and just add some very basic styles:</p>
<div class="igBar"><span id="lcss-67"><a href="#" onclick="javascript:showPlainTxt('css-67'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-67">
<div class="css">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;style&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; table<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; border<span style="color: #3333ff;">:10px </span>solid #000;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span>:5px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span>:#fff;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; table td<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border</span>:<span style="color: #993333;">none</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">margin</span>:2px;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; table caption<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; font<span style="color: #3333ff;">:<span style="color: #993333;">bold</span> </span>12px Verdana, Arial, Helvetica, <span style="color: #993333;">sans-serif</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">text-align</span>:<span style="color: #000000; font-weight: bold;">left</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; table td a img<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span>:2px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; table td a<span style="color: #3333ff;">:hover </span>img<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span>:0px;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; border<span style="color: #3333ff;">:2px </span>solid #f00;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/style&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><a href="/gallery-example-2/" target="_blank" rel="nofollow">Current progress</a></p>
<p>As it stands now, you can leave well enough alone and for the most part, people will be happy with your creation.  They have a simply style, low bandwidth, accessible and functional photogallery that will do exactly what you want, display images and open an image when clicked.</p>
<p>But lets, kick it up an notch and add in the JavaScript; enter jQuery and the beauty of plugins.</p>
<h3>Step 4: The JavaScript and the framework that we love, jQuery</h3>
<p>For those who don't know what jQuery is, it is a JavaScript framework that helps you "write less, do more."  Have a look over at <a href="http://jquery.com" target="_blank" rel="nofollow">http://jquery.com</a> for more info.</p>
<p>We are going to create our plugin now that will take our current gallery and spice it up.</p>
<p>The basic pattern for a jQuery plugin is as followed:</p>
<div class="igBar"><span id="ljavascript-68"><a href="#" onclick="javascript:showPlainTxt('javascript-68'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-68">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; $.<span style="color: #006600;">fn</span>.<span style="color: #006600;">yourPlugin</span> = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>index<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// code here</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#40;</span>jQuery<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Here we are using <em>closures</em>, I am not an expert, so I'll post some links at the bottom to other resources to help you understand why we are using this structure.  But this is the structure we will be using for our plugin.  What I can tell you is that the <strong>return this</strong> part of the code makes this plugin chainable.</p>
<p>We are going to keep this very simple, so we will not be passing any options or are we going to be creating any really complex situations.</p>
<p>What we are going to do is create some structure, get some data, and add some functionality.</p>
<h3>The Variables</h3>
<p>We will start out with creating some variables for use through-out our plugin:</p>
<div class="igBar"><span id="ljavascript-69"><a href="#" onclick="javascript:showPlainTxt('javascript-69'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-69">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> element = <span style="color: #000066; font-weight: bold;">this</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">element.<span style="color: #006600;">index</span> = index;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> $this = $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> $img = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'img'</span>, $this<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The purpose of "<strong>var element = this;</strong>" is to keep us from getting confused when using <strong>this</strong> in other parts of the code.</p>
<p>The purpose of "<strong>element.index = index;</strong>" is for if we have more then one gallery on a page we will be able to reference the correct one if needed.</p>
<p>The purpose of "<strong>var $this = $(this);</strong>" is so that we don't have to do <strong>$(this)</strong> multiple times slowing down our plugin.  This way, we can do $this.Method() and jQuery will not have to keep looking for what <strong>this</strong> is.</p>
<p>The purpose of "<strong>var $img = $('img', $this);</strong>" is to create a reference to all the images that are within our element.</p>
<h3>The Structure</h3>
<p>Our structure is going to be very simple and will look like:</p>
<div class="igBar"><span id="lhtml-70"><a href="#" onclick="javascript:showPlainTxt('html-70'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-70">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"wrap"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"head"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"container"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"imageItem"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">""</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">""</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">"0"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">""</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">""</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"imageContainer"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"fullsize"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>With the DIV of "imageItem" having the same count as the images in your default gallery.</p>
<p>Why not just use the structure that is already created with the table?  I personally feel you get more flexibly to style the Gallery and really punch it up by restructuring the gallery.</p>
<p>Lets get to building this structure:</p>
<div class="igBar"><span id="ljavascript-71"><a href="#" onclick="javascript:showPlainTxt('javascript-71'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-71">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">element.<span style="color: #006600;">wrap</span> = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'&lt;div class=&quot;wrap&quot;&gt;'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">element.<span style="color: #006600;">head</span> = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'&lt;div class=&quot;head&quot;&gt;'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">appendTo</span><span style="color: #66cc66;">&#40;</span>element.<span style="color: #006600;">wrap</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">element.<span style="color: #006600;">container</span> = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'&lt;div class=&quot;container&quot;&gt;'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">appendTo</span><span style="color: #66cc66;">&#40;</span>element.<span style="color: #006600;">wrap</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">element.<span style="color: #006600;">imageItem</span> = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'&lt;div class=&quot;imageItem&quot;&gt;'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">imageContainer = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'&lt;div class=&quot;imageContainer&quot;&gt;'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">appendTo</span><span style="color: #66cc66;">&#40;</span>element.<span style="color: #006600;">container</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">element.<span style="color: #006600;">fullsize</span> = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'&lt;img class=&quot;fullsize&quot;/&gt;'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">appendTo</span><span style="color: #66cc66;">&#40;</span>element.<span style="color: #006600;">imageContainer</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// img code here</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$this.<span style="color: #006600;">after</span><span style="color: #66cc66;">&#40;</span>element.<span style="color: #006600;">wrap</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">remove</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>The Thumbnails</h3>
<p>Next up is getting our images and their respective links and then add our click event:</p>
<div class="igBar"><span id="ljavascript-72"><a href="#" onclick="javascript:showPlainTxt('javascript-72'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-72">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$img.<span style="color: #006600;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> jqimg = $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> img = <span style="color: #000066; font-weight: bold;">this</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; img.<span style="color: #006600;">index</span> = i;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; img.<span style="color: #006600;">fullurl</span> = jqimg.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">attr</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'href'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; img.<span style="color: #006600;">height</span> = jqimg.<span style="color: #006600;">height</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; img.<span style="color: #006600;">width</span> = jqimg.<span style="color: #006600;">width</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; element.<span style="color: #006600;">imageItem</span>.<span style="color: #006600;">clone</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span>jqimg<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">appendTo</span><span style="color: #66cc66;">&#40;</span>element.<span style="color: #006600;">container</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; jqimg.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; element.<span style="color: #006600;">fullsize</span>.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">src</span> = img.<span style="color: #006600;">fullurl</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Ok, what do we have here, line 1 we start to loop through our images, line 2 setting a reference to the jQuery object for the image.</p>
<p>Line 3 is a reference to <strong>this</strong>.<br />
Line 4 is our index<br />
Line 5 is our reference to the link url</p>
<p>Line 6 and 7 is the height and width, this could be done a different way by create a <strong>new Image</strong> and creating a onload event where you grab the height and width and have the option to have a "loader" animated gif or notice text.  I did nether to keep this as simple as possible.</p>
<p>You will notice starting at line 9 that I am using what is called chaining, this is a process of linking one method to another.  But also notice that I put the new methods on separate lines.  Why would I do this when I could have chained the one right after another?  Because you actually need to be able to read your code.  Although chaining is great and you can chain a ton of methods one right after another after another, if you can't follow what is going on, it is pointless.</p>
<p>You will see at line 9 I am using the <strong>clone()</strong>, this allows me to quick duplicate the DIV that I created in my structure code.</p>
<p>Line 10 I am appending the image to the newly cloned DIV and at line 11 I am appending both to the container that is housing our thumbnails.</p>
<p>At line 13 I bind a click event, which can also be done by doing <strong>$(SELECTOR).bind('click',function(){});</strong>, to the thumbnail.</p>
<p>Inside that click event at line 14 I take the reference to the larger image and set the src to the full url that I collected at line 5.  But notice that I am using the <strong>.get(0)</strong> method with the <strong>.src</strong> attribute and not doing <strong>$(SELECTOR).attr('src',img.fullurl);</strong>.  Why did I do it this way?  To show you another example of the flexibility of<br />
jQuery.  JavaScript has a ton of built in attributes for each DOM element and using <strong>$(SELECTOR).get(0)</strong> is more or less the equivalent of <strong>getElementById</strong>.  The <strong>0</strong> is referencing the first element found, so if you want to get the fifth element found, you can do <strong>.get(4)</strong>.</p>
<p>Lets take a look at our <a href="/gallery-example-3/" target="_blank" rel="nofollow">Current progress</a>. (note: this is unstyled and will just be a single column of thumbnails with the larger showing up at the bottom when a thumbnail is clicked.  We will cover the styling in another post because there will be more then style that will need to be done.)</p>
<p>What you will see in the final example is just a list of thumbnails and once clicked you will see the full size image appear.</p>
<h3>The Follow-up</h3>
<p>I know I covered a lot and I was trying to keep it as simple as possible, so let review what we did.  We create a basic photogallery using basic (x)Html and styles that will work fine if JavaScript is turned off or if a Screen-reader was used to view the photogallery.  We then took that gallery and with the help of JavaScript and jQuery we created a very basic photogallery and a reusable jQuery plugin.  We learned how to use some of jQuery's basic methods to grab an element and do something with it.  </p>
<p>What we did not do is actually quite a lot.  We did not add styles. We did not add any indicators that an image is loading.  We did not resize the large image to fit with in a confined area.  We did not create any preloading code that will preload the next large image in our list.</p>
<h3>The Closing</h3>
<p>I will be writing another post that will take care of our "We did not do" items.  The purpose of the post was to show you how to build your own plugin and even how to build an effective photogallery.</p>
<p>The may be some items that you don't understand or would like me to elaborate on, feel free to let me know what those items are and I will try to clarify.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/create-an-unobtrusive-photo-gallery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery: Select what you want &#8211; part 2</title>
		<link>http://benjaminsterling.com/jquery-select-what-you-want-part-2/</link>
		<comments>http://benjaminsterling.com/jquery-select-what-you-want-part-2/#comments</comments>
		<pubDate>Tue, 27 Nov 2007 03:28:47 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[selectors]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/2007/11/26/jquery-select-what-you-want-part-2/</guid>
		<description><![CDATA[In my first post about jQuery Selectors call Select what you want, I went over some basic selectors that I use on a daily basis within a web based training framework I put together using jQuery.  What I would like to cover are some of the situations I have ran into over the past [...]]]></description>
			<content:encoded><![CDATA[<div class='series_toc'><h3>Table of contents for Select anything</h3><ol><li><a href='http://benjaminsterling.com/jquery-select-what-you-want-part-1/' title='jQuery: Select what you want &#8211; part 1'>jQuery: Select what you want &#8211; part 1</a></li><li>jQuery: Select what you want &#8211; part 2</li></ol></div> <p>In my first post about jQuery Selectors call <a href="http://benjaminsterling.com/2007/11/25/jquery-select-what-you-want-part-1/">Select what you want</a>, I went over some basic selectors that I use on a daily basis within a web based training framework I put together using jQuery.  What I would like to cover are some of the situations I have ran into over the past year while using jQuery are my frameworks backbone.</p>
<p>Some of the selections we will cover are searching for links with an specific extension, images, images that wrapped in a link, links and definition lists.</p>
<p>Let me give you some background on the process.  We have a content writer who supplies us with with a storyboard for the content and flow.  We then create a separate Html page for each page within that storyboard.  Each one of these pages is brought into the main page using the .load method for jQuery.  All the selections are being done in the callback of the .load method, like:</p>
<div class="igBar"><span id="ljavascript-87"><a href="#" onclick="javascript:showPlainTxt('javascript-87'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-87">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">".textArea"</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">empty</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">load</span><span style="color: #66cc66;">&#40;</span>URL, <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// selection calls</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The following will be the functional request that the writer asks for.  Note the "<strong>this</strong>" in my selector calls is referring to <strong>textArea</strong>.  Also note that these will not be optimized calls, for instance, if I were going to check for images or links multiple times for different things, I would do something like:</p>
<div class="igBar"><span id="ljavascript-88"><a href="#" onclick="javascript:showPlainTxt('javascript-88'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-88">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> $img = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"img"</span>, <span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> $a = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"a"</span>, <span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>But for the purpose of this post, I will code as if there is only one thing we are looking for and most of these will be very simple selections.</p>
<p>Functional request:  Have smaller image open a bigger image in a jqModal box</p>
<h5>The Html</h5>
<div class="igBar"><span id="lhtml-89"><a href="#" onclick="javascript:showPlainTxt('html-89'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-89">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"path/to/big"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"jqModal"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"path/to/small"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h5>The JavaScript</h5>
<div class="igBar"><span id="ljavascript-90"><a href="#" onclick="javascript:showPlainTxt('javascript-90'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-90">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"a.jqModal:has( img )"</span>, <span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// jqModal code</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Functional request:  Have a "how-to" open in a jqModal iframed box</p>
<h5>The Html</h5>
<div class="igBar"><span id="lhtml-91"><a href="#" onclick="javascript:showPlainTxt('html-91'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-91">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"path/to/howto"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"jqModalFramed"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>How to link text<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h5>The JavaScript</h5>
<div class="igBar"><span id="ljavascript-92"><a href="#" onclick="javascript:showPlainTxt('javascript-92'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-92">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"a.jqModalFramed"</span>, <span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// jqModal code</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Functional request:  Have pdfs alert before opening</p>
<h5>The Html</h5>
<div class="igBar"><span id="lhtml-93"><a href="#" onclick="javascript:showPlainTxt('html-93'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-93">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"thePdf.pdf"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>View PDF<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h5>The JavaScript</h5>
<div class="igBar"><span id="ljavascript-94"><a href="#" onclick="javascript:showPlainTxt('javascript-94'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-94">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"a[href$='.pdf'"</span>, <span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// prompt box code</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Functional request:  Have glossary of words and when those words a clicked, show it's definition</p>
<h5>The Html</h5>
<div class="igBar"><span id="lhtml-95"><a href="#" onclick="javascript:showPlainTxt('html-95'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-95">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/dl.html"><span style="color: #000000; font-weight: bold;">&lt;dl&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/dt.html"><span style="color: #000000; font-weight: bold;">&lt;dt&gt;</span></a></span>Word<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dt&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">&lt;dd&gt;</span></a></span>Definition<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dd&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dl&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h5>The JavaScript</h5>
<div class="igBar"><span id="ljavascript-96"><a href="#" onclick="javascript:showPlainTxt('javascript-96'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-96">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'dl'</span>, <span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'DT'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">toggle</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'open'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">removeClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'closed'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">nextUntil</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'DT'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span>,<span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">removeClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'open'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'closed'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">nextUntil</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'DT'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">hide</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'closed'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">nextUntil</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'DT'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">hide</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Functional request:  Have have a group of radio buttons and when clicked, have them show a response</p>
<h5>The Html</h5>
<div class="igBar"><span id="lhtml-97"><a href="#" onclick="javascript:showPlainTxt('html-97'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-97">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/input.html"><span style="color: #000000; font-weight: bold;">&lt;input</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"radio"</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"answer1"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">&lt;p</span></a> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"answer answer1"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>Text<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h5>The JavaScript</h5>
<div class="igBar"><span id="ljavascript-98"><a href="#" onclick="javascript:showPlainTxt('javascript-98'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-98">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"input[type=radio]"</span>,<span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'.answer'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">hide</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&nbsp; <span style="color: #009900; font-style: italic;">// these are p tags that contain the answers</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> current = $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">attr</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'name'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'.'</span>+current<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">highlightFade</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'yellow'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Functional request:  Have external links prompt that they are going outside of site</p>
<h5>The Html</h5>
<div class="igBar"><span id="lhtml-99"><a href="#" onclick="javascript:showPlainTxt('html-99'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-99">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"epa.gov/radiation/"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>View PDF<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h5>The JavaScript</h5>
<div class="igBar"><span id="ljavascript-100"><a href="#" onclick="javascript:showPlainTxt('javascript-100'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-100">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"a"</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">filter</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">href</span>.<span style="color: #006600;">match</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066FF;">/.<span style="color: #006600;">com</span>|.<span style="color: #006600;">gov</span>|.<span style="color: #006600;">edu</span>/</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// prompt box code</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h5>The Final Word</h5>
<p>Each project comes with different requirements; the requirements above were only a small part of the requirements for the most recent project but the rest of the list was pretty simple stuff.  Feel free to post question or corrections.</p>
 <div class='series_links'><a href='http://benjaminsterling.com/jquery-select-what-you-want-part-1/' title='jQuery: Select what you want &#8211; part 1'>Previous in series</a> </div>]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/jquery-select-what-you-want-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery: Select what you want &#8211; part 1</title>
		<link>http://benjaminsterling.com/jquery-select-what-you-want-part-1/</link>
		<comments>http://benjaminsterling.com/jquery-select-what-you-want-part-1/#comments</comments>
		<pubDate>Mon, 26 Nov 2007 03:12:46 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[selectors]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/2007/11/25/jquery-select-what-you-want-part-1/</guid>
		<description><![CDATA[In an earlier post I wrote about what are the fastest basic selectors and found out some interesting stuff with regards to speed for some basic selectors.  In this post I am going to go over some not-so-basic selectors.  I am going to try not to repeat what Karl has said in his [...]]]></description>
			<content:encoded><![CDATA[<div class='series_toc'><h3>Table of contents for Select anything</h3><ol><li>jQuery: Select what you want &#8211; part 1</li><li><a href='http://benjaminsterling.com/jquery-select-what-you-want-part-2/' title='jQuery: Select what you want &#8211; part 2'>jQuery: Select what you want &#8211; part 2</a></li></ol></div> <p>In an earlier post I wrote about <a href="http://benjaminsterling.com/2007/11/23/jquery-what-are-the-fastest-selector/">what are the fastest basic selectors</a> and found out some interesting stuff with regards to speed for some basic selectors.  In this post I am going to go over some not-so-basic selectors.  I am going to try not to repeat what Karl has said in his two posts, "<a href="http://www.learningjquery.com/2006/11/how-to-get-anything-you-want-part-1">How to Get Anything You Want - part 1</a>" and "<a href="http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2">How to Get Anything You Want - part 2</a>", but some may be worth repeating.</p>
<p>To keep my searches confined to a certain div with a class of "theDiv" using calls like:</p>
<div class="igBar"><span id="ljavascript-102"><a href="#" onclick="javascript:showPlainTxt('javascript-102'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-102">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"SELECTOR"</span>, <span style="color: #3366CC;">".theDiv"</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Basically what this does is searches for the element with the class of "theDiv" and then searches for "SELECTOR" within that result.</p>
<div class="theDiv" style="border:1px solid #ccc;padding:5px;background:#eaeaea;color:#000">
<table cellpadding="3" cellspacing="0" border="1" width="100%">
<tbody>
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
<td>Cell 3</td>
<td>Cell 4</td>
<td></td>
<td>Cell 6</td>
</tr>
</tbody>
</table>
<p>See the quick brown fox jump <span>over</span> the lazy dog.</p>
<ul>
<li>This is 1</li>
<li>This is 2</li>
<li>3 this is</li>
<li></li>
<li>This is 4</li>
<li>This is 5</li>
</ul>
<input type="button" name="submit" value="Submit button"/>
<input type="submit" name="submit" value="Submit button"/>
<input type="text" name="getMe" value="Not Empty"/>
<input type="text" id="noValue" name="getMe" value=""/>
<input type="text" id="noName" name="" value="No Name Attribute"/>
<div style="display:none;">I am set as display:none</div>
<div style="visibility:hidden;">I am set as visibility:hidden</div>
</p></div>
<h6>We are are going to start off with some "Attribute Filters"</h6>
<p>
<input type="submit" name="test1" value="Test 1 toggle"/> $("[name]") Gets each element with an attribute of "name".  Note that the last	text field did not get highlighted, although it does have an attribute "name" , it is empty, so therefore not selected.</p>
<p>
<input type="submit" name="test2" value="Test 2 toggle"/> $("input[name]") Is the same as above, except we are limiting the return to inputs and if you run each with firebug running on "Profile," this one takes more calls to find the correct element(s).</p>
<p>
<input type="submit" name="test3" value="Test 3 toggle"/> $("[name=getMe]") This one is only grabbing the elements that have the "name" attribute with a value of "getMe"</p>
<p>
<input type="submit" name="test4" value="Test 4 toggle"/> $("[name!=getMe]") This one is only grabbing the elements that <strong>don't</strong> have the "name" attribute with a value of "getMe" and as you can see it even grabbed the elements that did not have the "name" attribute at all.</p>
<p>
<input type="submit" name="test5" value="Test 5 toggle"/> $("[type^=b]") This one matches elements that have the "type" attribute and the value of the "type" attribute starts with a "b".  (in my test area the one submit button has a type of button)</p>
<p>
<input type="submit" name="test6" value="Test 6 toggle"/> $("[type$=t]") This one gets all the elements that has the "type" attribute and it's value ends with "t."</p>
<p>
<input type="submit" name="test7" value="Test 7 toggle"/> $("[value*=no]") This one will match all elements with "no" in it.</p>
<p>
<input type="submit" name="test8" value="Test 8 toggle"/> $("[id*=no]")  Same as "Test 7" except we are grabbing all elements with "no" in the ID </p>
<p>
<input type="submit" name="test9" value="Test 9 toggle"/> $("[id*=no][name=getMe]")</p>
<h6>Wow, that was fun, what did we learn?  You can select anything you want by attribute alone.  Let's get into some "Content Filters"</h6>
<p>
<input type="submit" name="test10" value="Test 10 toggle"/> $(":contains('Cell')") Here we are getting all element with the word "Cell" in it and since we did not filter out what element we wanted, the TABLE, TBODY, TR, and the TD all got selected because they all contained the word "Cell". Note my earlier comment that I am using $(&quot;:contains('Cell')&quot;, &quot;.theDiv&quot;) in my javascript to limit the return results to the containing div, otherwise the BODY and HTML tag and the other elements between BODY and the items with the &quot;Cell&quot; text. </p>
<p>
<input type="submit" name="test11" value="Test 11 toggle"/> $("td:contains('Cell')") Here is the same approach but we will be restricting our search to just the TD.</p>
<p>
<input type="submit" name="test12" value="Test 12 toggle"/> $(":empty") Selects every element that is empty.  If you don't limit your search to items that are <strong>not</strong> form elements, you will get the input fields.</p>
<p>
<input type="submit" name="test13" value="Test 13 toggle"/> $(":has(span)") Selects all elements that <strong>has</strong> a span in it</p>
<p>
<input type="submit" name="test14" value="Test 14 toggle"/> $(":parent") Selects all elements that are "parent" elements</p>
<h6>Oh; you want to be able to get hidden elements?  Visible elements?</h6>
<p>
<input type="submit" name="test15" value="Test 15 toggle"/> $(":hidden") Selects all elements that are hidden, this includes items with a style of display:none or visibility:hidden and input elements with a type of &quot;hidden.&quot; </p>
<p>
<input type="submit" name="test16" value="Test 16 toggle"/> $(":visible") Selects all elements that are visible. </p>
<h6>Where do we go from here</h6>
<p>If you have visited the <a href="http://docs.jquery.com/Selectors" title="jQuery Documentation on Selectors" target="_blank">jQuery Documentation on Selectors</a> you will see that I have not gone over anything new, just maybe rephrased it in "my terms."  These, for the most part, are the selectors I would use on a daily basis, so I felt that these were the best place to start.  Some approaches my be faster, so I would suggest that you take some "me" time and see which ones will work the best in your situation.</p>
<p>In a future alticle, I am going to cover some of the approaches I take with a web base training framework that I think will benifit you</p>
 <div class='series_links'> <a href='http://benjaminsterling.com/jquery-select-what-you-want-part-2/' title='jQuery: Select what you want &#8211; part 2'>Next in series</a></div>]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/jquery-select-what-you-want-part-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery: what are the fastest selectors?</title>
		<link>http://benjaminsterling.com/jquery-what-are-the-fastest-selector/</link>
		<comments>http://benjaminsterling.com/jquery-what-are-the-fastest-selector/#comments</comments>
		<pubDate>Fri, 23 Nov 2007 20:40:21 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[selectors]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/2007/11/23/jquery-what-are-the-fastest-selector/</guid>
		<description><![CDATA[Update 12/07/2007: per Brian Cherne comments, I decided to run these test again in Firefox with firebug lite instead of firebug and the execution times were dreastically different.  So, to "level the playing field" I would suggest that you turn off firebug or disable it for the page and refresh, you will get the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update 12/07/2007:</strong> per <a href="#comment-319">Brian Cherne comments</a>, I decided to run these test again in Firefox with firebug lite instead of firebug and the execution times were dreastically different.  So, to "level the playing field" I would suggest that you turn off firebug or disable it for the page and refresh, you will get the firebug lite console pop up at the bottom of the screen and then run the test.  You will get much better results; but I most ask this question, because after searching I could not find the answer, why the difference in speeds?</p>
<p>I've been using jQuery for over a year now and have built some pretty big apps with it as my "selector" engine and had always wondered what were the fastest ways to select an element.  After reading a post on the mailing list I decided to put some selectors to test.  First thing I had to figure out what was the best way to really test out some selectors.  So I went about just grabbing some site I came across while <a href="http://emevas1977.stumbleupon.com/" rel="nofollow">Stumbling</a>, but after doing some testing using that sites content I came to the realization that I would not know how to implement a "test" suite on my site.  So what I decided was to just implement an on the fly test suite on my content.</p>
<p>With that said, here we go:</p>
<p>If you do not have firebug installed, you will have a Firebug lite console pop up at the bottom of the screen.  If you do have Firebug installed, be sure to open it to follow along.</p>
<p>This page has <span id="domCount">x</span> DOM elements on it.  So, what ever selection we make will cycle/search through that total number of elements.</p>
<p>First up is to find an element with the ID of "shareThisBookmarkThisone" (this is the "Share this..." div that is currently hidden) and to select this element we will do:</p>
<div class="igBar"><span id="ljavascript-109"><a href="#" onclick="javascript:showPlainTxt('javascript-109'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-109">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"#shareThisBookmarkThisone"</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<input type="submit" name="submit" value="Run Test 1" id="shareThisBookmarkThisoneButton"/>
<p>After running that test you should have a number around 10 - 20 milliseconds.  In this case, it is the equivalent of "getElementById" which is a built in JavaScript method that searches for an element node with an id attribute whose value is "shareThisBookmarkThisoneButton."</p>
<p>Pretty simple selector, lets move onto another simple one that should be pretty fast.</p>
<p>On this page, I have <span id="divCount">x</span> DIV elements.</p>
<div class="igBar"><span id="ljavascript-110"><a href="#" onclick="javascript:showPlainTxt('javascript-110'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-110">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"div"</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<input type="submit" name="submit" value="Run Test 2" id="runTest2"/>
<p>After running that one, you should be looking at something between 0 - 10ms with Firefox about the 100ms range, once again, pretty simple.</p>
<p>Now let start getting into what selection methods are faster, say we want one of those DIVs with a class of "adspace," which approach would be faster?  One this page, I know we only have one to work with, so we should be able to get a reasonable return time.</p>
<p>Our first approach would be:</p>
<div class="igBar"><span id="ljavascript-111"><a href="#" onclick="javascript:showPlainTxt('javascript-111'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-111">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">".adspace"</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<input type="submit" name="submit" value="Run Test 3" id="runTest3"/>
<div class="igBar"><span id="ljavascript-112"><a href="#" onclick="javascript:showPlainTxt('javascript-112'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-112">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"div.adspace"</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<input type="submit" name="submit" value="Run Test 4" id="runTest4"/>
<div class="igBar"><span id="ljavascript-113"><a href="#" onclick="javascript:showPlainTxt('javascript-113'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-113">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"div"</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">filter</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">".adspace"</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<input type="submit" name="submit" value="Run Test 5" id="runTest5"/>
<p>For "Test 3" we should get about 15ms in Firefox 2, Safari 3, between 0 - 16ms in Opera 9.2 and 0ms in IE6 and IE7, whereas we get 0ms across the board for "Test 4."  Now in "Test 5" we get 0ms for all except Firefox, where we get around 15ms.</p>
<p>What does the above tell us?  That if there is only one element things are quicker?  Not sure, but lets put that to the test, I posted some empty DIVs, some with a class of "selectMe" and others with some random classes, you can view the source to see what these DIVs look like.
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="sick"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="bike"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="car"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="igBar"><span id="ljavascript-114"><a href="#" onclick="javascript:showPlainTxt('javascript-114'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-114">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">".adspace"</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"div.adspace"</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"div"</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">filter</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">".adspace"</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<input type="submit" name="submit" value="Run Test 6" id="runTest6"/>
<p>With "Test 6" we are looking getting back 153 results and I really must say that I am a little shocked by the results:</p>
<ul>
<li>IE7
<ul>
<li>6.1: 16ms</li>
<li>6.2: 15ms</li>
<li>6.3: 0ms</li>
</ul>
</li>
<li>Safari
<ul>
<li>6.1: 16ms</li>
<li>6.2: 0ms</li>
<li>6.3: 0ms</li>
</ul>
</li>
<li>Opera
<ul>
<li>6.1: 31ms</li>
<li>6.2: 0ms</li>
<li>6.3: 0ms</li>
</ul>
</li>
<li>Firefox with firebug
<ul>
<li>6.1: 141ms</li>
<li>6.2: 109ms</li>
<li>6.3: 109ms</li>
</ul>
</li>
<li>Firefox with firebug lite
<ul>
<li>6.1: 31ms</li>
<li>6.2: 0ms</li>
<li>6.3: 0ms</li>
</ul>
</li>
</ul>
<h5>Final Notes</h5>
<p>Before we get into what we learned let me put a bit of a disclaimer here.  I have not really looked into the full workings of the jQuery framework, so anything I say is based off of my assumptions and what I learned as I have built with it.  The numbers you see above are from browsers that are running on a not so average computer, so they are not from the average user's/client's computer.</p>
<p>What did we learn?  That if you are looking for all elements with a certain class and they are all of the same tag name, do $("TAGNAME.CLASSNAME") or $("TAGNAME").filter(".CLASSNAME").  That if you have only a single element that needs to be called and there will not be duplicates, your fastest selector is going to be the $("#ID") selector.  That<del datetime="2007-12-08T01:50:05+00:00">, with the exception of Firefox,</del> the leading browsers handle a TAG search pretty quickly.  Firefox had comparable speeds to the other browsers once firebug is turned off.</p>
<p>Something to keep in mind is that we did not do any manipulations, ie. css(), append(), animate(), or any really complex selectors and those will add time your actions.</p>
<p>jQuery is the library of choice for me, you are free to use any of the many libraries out there.</p>
<p><script type="text/javascript">
	$(document).ready(function(){
		if (!("console" in window) || !("firebug" in console)) {
			$("html").attr("debug","true");
			$("body").css("padding-bottom",200);
			$.getScript("/firebug/firebug.js");
		}
		$("#domCount").text($("*").size());
		$("#divCount").text($("div").size());
		$("#shareThisBookmarkThisoneButton").click(function(){
				console.time("test 1");
				var _this = $("#shareThisBookmarkThisone");
				console.log(_this);
				console.log("#shareThisBookmarkThisone count: " +_this.size());
				console.timeEnd("test 1");
			return false;
		});
		$("#runTest2").click(function(){
				console.time("test 2");
				var _this = $("div");
				console.log(_this);
				console.log("DIV count: " +_this.size());
				console.timeEnd("test 2");
			return false;
		});
		$("#runTest3").click(function(){
				console.time("test 3");
				var _this = $(".adspace");
				console.log(_this);
				console.log("DIV count: " +_this.size());
				console.timeEnd("test 3");
			return false;
		});
		$("#runTest4").click(function(){
				console.time("test 4");
				var _this = $("div.adspace");
				console.log(_this);
				console.log("DIV count: " +_this.size());
				console.timeEnd("test 4");
			return false;
		});
		$("#runTest5").click(function(){
				console.time("test 5");
				var _this = $("div").filter(".adspace");
				console.log(_this);
				console.log("DIV count: " +_this.size());
				console.timeEnd("test 5");
			return false;
		});
		$("#runTest6").click(function(){
				console.time("test 6.1");
				var _this = $(".selectMe");
				console.log(_this);
				console.log(".selectMe count: " +_this.size());
				console.timeEnd("test 6.1");
				console.time("test 6.2");
				var _this = $("div.selectMe");
				console.log(_this);
				console.log("div.selectMe count: " +_this.size());
				console.timeEnd("test 6.2");
				console.time("test 6.3");
				var _this = $("div").filter(".selectMe");
				console.log(_this);
				console.log("div filter selectMe count: " +_this.size());
				console.timeEnd("test 6.3");
			return false;
		});
	});
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/jquery-what-are-the-fastest-selector/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>
