<?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>tobypitman.com</title>
	<atom:link href="http://www.tobypitman.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tobypitman.com</link>
	<description>Official website of guitarist Toby Pitman</description>
	<lastBuildDate>Wed, 10 Feb 2010 12:09:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>On Holiday!</title>
		<link>http://www.tobypitman.com/on-holiday/</link>
		<comments>http://www.tobypitman.com/on-holiday/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 12:09:10 +0000</pubDate>
		<dc:creator>Toby</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.tobypitman.com/?p=287</guid>
		<description><![CDATA[I'm now offically on holiday! Been about 10 years since I took a proper one so it's well earned!]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m now offically on holiday! Been about 10 years since I took a proper one so it&#8217;s well earned!</p>
<p><a href="http://www.tobypitman.com/wp-content/uploads/2010/02/holiday.jpg"><img class="alignnone size-full wp-image-289" title="holiday" src="http://www.tobypitman.com/wp-content/uploads/2010/02/holiday.jpg" alt="holiday" width="590" height="289" /></a></p>
<p>No computers, no phone (I am taking it but won&#8217;t answer!). Back on 18th of March&#8230;.with a tan!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tobypitman.com/on-holiday/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Link to &#8216;child pages&#8217; in Wordpress with &#8216;the_post_thumbnail&#8217;</title>
		<link>http://www.tobypitman.com/link-to-child-pages-in-wordpress-with-the_post_thumbnail/</link>
		<comments>http://www.tobypitman.com/link-to-child-pages-in-wordpress-with-the_post_thumbnail/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 18:56:53 +0000</pubDate>
		<dc:creator>Toby</dc:creator>
				<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.tobypitman.com/?p=248</guid>
		<description><![CDATA[I thought I'd share this with anybody who's interested. I'm currently developing a site based in Wordpress that has a lot of nested child pages.]]></description>
			<content:encoded><![CDATA[<p>I thought I&#8217;d share this with anybody who&#8217;s interested. I&#8217;m currently developing a site based in Wordpress that has a lot of nested child pages.</p>
<p>I&#8217;ve used the new &#8216;Post Thumbnail&#8217; feature in 2.9 to link to the child pages from the &#8216;Parent&#8217; page using the Post Thumbnail as an image link. The reason for this is the client no longer has to faff about with customs fields, which are confusing to non-web savvy users.</p>
<p>This might be useful for people building portfolio sites for artists.</p>
<p>The code I&#8217;d previously been dabbling with pulled in a custom field called &#8216;Imagelink&#8217; from all the child pages associated with the parent page providing an image link to that child page.</p>
<p>The code below uses &#8216;get_the_post_thumbnail()&#8217; so all the client has to do is upload an image using the new &#8216;Post Thumbnail&#8217; feature in every new page as the link image.</p>
<p><a href="http://www.tobypitman.com/wp-content/uploads/2009/12/ms-1.jpg"><img class="alignnone size-full wp-image-251" title="ms-1" src="http://www.tobypitman.com/wp-content/uploads/2009/12/ms-1.jpg" alt="ms-1" width="305" height="86" /></a></p>
<p>Insert it into a page template in wordpress called &#8216;childLinks&#8217; or something like that.</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$pages</span> <span style="color: #339933;">=</span> get_pages<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'child_of='</span><span style="color: #339933;">.</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&amp;sort_column=post_date&amp;sort_order=desc&amp;parent='</span><span style="color: #339933;">.</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp;<span style="color: #000088;">$count</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <br />
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pages</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$page</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$page</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_content</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span><br />
<br />
&lt;div class=&quot;childPageLink&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_page_link<span style="color: #009900;">&#40;</span><span style="color: #000088;">$page</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_the_post_thumbnail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$page</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'full'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&lt;/div&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
<p>Pretty handy and more CMS like.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tobypitman.com/link-to-child-pages-in-wordpress-with-the_post_thumbnail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IGF Bath 2009</title>
		<link>http://www.tobypitman.com/igf-bath-2009/</link>
		<comments>http://www.tobypitman.com/igf-bath-2009/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 11:16:28 +0000</pubDate>
		<dc:creator>Toby</dc:creator>
				<category><![CDATA[Guitar stuff]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.tobypitman.com/?p=238</guid>
		<description><![CDATA[Got back from my yearly stint at Bath Spa University teaching for the International Guitar Foundation. A good time was had by all as usual and great to see some old faces and catch up.]]></description>
			<content:encoded><![CDATA[<p>Been a while since any updates here, and I mean a while! Been busy in the studio and I&#8217;ll write about what I&#8217;ve been up to soon.</p>
<p>Got back from my yearly stint at Bath Spa University teaching for the International Guitar Foundation. A good time was had by all as usual and great to see some old faces and catch up.</p>
<p>Some great gigs were provided during the week by John Wheatcroft, Stanton Moore and old BIMM friend Guthrie Govan with the Fellowship. Here&#8217;s a couple of pics of the week. Looking forward to next time!</p>
<div id="attachment_239" class="wp-caption alignnone" style="width: 600px"><a href="http://www.tobypitman.com/wp-content/uploads/2009/08/theband.jpg"><img src="http://www.tobypitman.com/wp-content/uploads/2009/08/theband.jpg" alt="My class - Classic Rock!" title="theband" width="590" height="308" class="size-full wp-image-239" /></a><p class="wp-caption-text">My class - Classic Rock!</p></div>
<div id="attachment_240" class="wp-caption alignnone" style="width: 600px"><a href="http://www.tobypitman.com/wp-content/uploads/2009/08/curry.jpg"><img src="http://www.tobypitman.com/wp-content/uploads/2009/08/curry.jpg" alt="Tutors eating a well deserved curry!" title="curry" width="590" height="243" class="size-full wp-image-240" /></a><p class="wp-caption-text">Tutors eating a well deserved curry!</p></div>
<div id="attachment_241" class="wp-caption alignnone" style="width: 600px"><a href="http://www.tobypitman.com/wp-content/uploads/2009/08/guthrie.jpg"><img src="http://www.tobypitman.com/wp-content/uploads/2009/08/guthrie.jpg" alt="Guthrie and the Fellowship rip it up!" title="guthrie" width="590" height="446" class="size-full wp-image-241" /></a><p class="wp-caption-text">Guthrie and the Fellowship rip it up!</p></div>
<div id="attachment_242" class="wp-caption alignnone" style="width: 600px"><a href="http://www.tobypitman.com/wp-content/uploads/2009/08/thelads.jpg"><img src="http://www.tobypitman.com/wp-content/uploads/2009/08/thelads.jpg" alt="Jim Clarke, Guthrie Govan and Martin Goulding. Guitar heaven!" title="thelads" width="590" height="418" class="size-full wp-image-242" /></a><p class="wp-caption-text">Jim Clarke, Guthrie Govan and Martin Goulding. Guitar heaven!</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.tobypitman.com/igf-bath-2009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New tutorial on Audiotuts</title>
		<link>http://www.tobypitman.com/new-tutorial-on-audiotuts/</link>
		<comments>http://www.tobypitman.com/new-tutorial-on-audiotuts/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 22:40:12 +0000</pubDate>
		<dc:creator>Toby</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.tobypitman.com/?p=221</guid>
		<description><![CDATA[Just had another tutorial go up on <a href="http://audiotuts.com">audiotuts.com</a> about using Logics automation with MIDI hardware controllers. Go check it out if your into Logic.

In other news apart from being snowed on a lot I've been learning Adobe After Effects and making some promos for my secret web project.]]></description>
			<content:encoded><![CDATA[<p>Just had another tutorial go up on <a href="http://audiotuts.com/tutorials/mixing-mastering/using-quick-automation-access-in-logic-8/">audiotuts.com</a> about using Logics automation with MIDI hardware controllers. Go check it out if your into Logic.</p>
<p>In other news apart from being snowed on a lot I&#8217;ve been learning Adobe After Effects and making some promos for my secret web project. Making good progress with it but knowing Photoshop animation already has really helped. <a href="http://videocopilot.com">VideoCopilot.com</a> has been a real help learning After Effects and Andrew Kramer is a good coach.</p>
<p>Just got Stormdrum 2 for the studio rig and I&#8217;m loving it. The drum sounds are massive! Here&#8217;s a little orchestral demo I threw together while I was trying it out. It&#8217;s called Attack of the Dung Beetles as I couldn&#8217;t think of a better title! There&#8217;s a scary thought!</p>
<p>Till next time!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tobypitman.com/new-tutorial-on-audiotuts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.tobypitman.com/wp-content/uploads/2009/02/attack-of-the-dung-beetles.mp3" length="1101033" type="audio/mpeg" />
		</item>
		<item>
		<title>Logic tutorial on AUDIOTUTS.COM</title>
		<link>http://www.tobypitman.com/logic-tutorial-on-audiotutscom/</link>
		<comments>http://www.tobypitman.com/logic-tutorial-on-audiotutscom/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 17:45:17 +0000</pubDate>
		<dc:creator>Toby</dc:creator>
				<category><![CDATA[Logic Pro]]></category>

		<guid isPermaLink="false">http://www.tobypitman.com/?p=218</guid>
		<description><![CDATA[Happy new year all! Just had my Chord Memorizer tutorial accepted by the lovely people over at <a href="http://audiotuts.com">audiotuts.com</a>. Planning to do some more for them this year and have some really solid and fun ideas lined up already.]]></description>
			<content:encoded><![CDATA[<p>Happy new year all! Just had my Chord Memorizer tutorial accepted by the lovely people over at <a href="http://audiotuts.com">audiotuts.com</a>. It&#8217;s had some really positive feedback so far. I might do a follow up to it on this site soon. Planning to do some more for them this year and have some really solid and fun ideas lined up already.</p>
<p>As far as this year goes with this blog I&#8217;m planning to do loads more guitar tutorials. I have about three big topics I want to cover so they may come in a few parts each. You can expect a small tutorial pretty soon on some useful pentatonic ideas.</p>
<p>2008 was a bit of a strange one for me as far as guitar goes as I was doing quite a bit of web stuff but I&#8217;m going to be scaling that back and really getting back to some good old playing this year. I guess I&#8217;d just burnt out a bit on music but that seems to be over now and I&#8217;m starting to feel a lot more creative musically ( lot&#8217;s of tunes rattling round the noggin! ).</p>
<p>In fact the only web stuff I&#8217;m planning is the launch of a new site aimed directly at guitar players. Can&#8217;t say much at the moment but it&#8217;s going to be amazing. Most of the material is written and I&#8217;ll start building the site soon. I&#8217;m hoping it&#8217;s going to be a big hit in the world of guitar, so stay tuned!!</p>
<p>You can check out the Logic tutorial <a href="http://audiotuts.com/tutorials/composition/play-chords-with-one-finger-using-logic-pros-chord-memorizer/">here</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.tobypitman.com/logic-tutorial-on-audiotutscom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery style menu with CSS3</title>
		<link>http://www.tobypitman.com/jquery-style-menu-with-css3/</link>
		<comments>http://www.tobypitman.com/jquery-style-menu-with-css3/#comments</comments>
		<pubDate>Sat, 20 Dec 2008 11:25:25 +0000</pubDate>
		<dc:creator>Toby</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.tobypitman.com/?p=196</guid>
		<description><![CDATA[Here's a quick experiment I did with CSS3. Again I was just mucking about with CSS3 transitions which could one day replace all the fancy jQuery animation tricks people use. The outcome was a really simple animated sliding verticle menu.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.tobypitman.com/wp-content/uploads/2008/12/css3menu.jpg" alt="css3menu" title="css3menu" width="590" height="300" class="alignnone size-full wp-image-210" /></p>
<p>Here&#8217;s a quick experiment I did with CSS3. Again I was just mucking about with CSS3 transitions which could one day replace all the fancy jQuery animation tricks people use. The outcome was a really simple animated sliding verticle menu.</p>
<p>If you want to view the demo <span style='color:red;' >you&#8217;ll need the lastest Safari</span> version or even better go get the latest nightly build of <a href="http://nightly.webkit.org/">webkit</a>. This might even work in Chrome but I haven&#8217;t checked it. Oddly enough it didn&#8217;t seem to like it on OSX Tiger in Coda but in Leopard it was fine? This is all a long way off anyway but good fun to play with! </p>
<p><a class="viewdemo" href="http://development.tobypitman.com/css/menu.html">Menu Demo</a></p>
<p>First off in the demo you might notice the gradient which is CSS too. Really easy to do that with this&#8230;.</p>
<pre>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">body <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -webkit-gradient<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00AA00;">&#40;</span>linear<span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">,</span> from<span style="color: #00AA00;">&#40;</span><span style="color: #cc00cc;">#ccc</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> to<span style="color: #00AA00;">&#40;</span><span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></div>
</pre>
<p>Now we&#8217;ll style the un-order list with some padding and a background image to create a ridge like effect that our menu items will appear out of. The cool thing about this is by using <span style='color:#c7d0cf;' >-webkit-background-size&#8217;</span> the image is stretched if you add more items to it making the whole thing a bit more dynamic.</p>
<pre>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ul<span style="color: #cc00cc;">#nav</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">60px</span> 0 <span style="color: #933;">60px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span>shad2.png<span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; -webkit-background-<span style="color: #000000; font-weight: bold;">size</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">50</span>%</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></div>
</pre>
<p>Everything else is pretty bog standard really. A simple un-ordered list and that&#8217;s about it. The styling for the list item anchor tags is where it all happens. The addition of the <span style='color:#c7d0cf;' >&#8216;-webkit-transition:&#8217;</span> is going to allow us to animate to the <span style='color:#c7d0cf;' >&#8216;:hover&#8217;</span> state.</p>
<pre>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ul<span style="color: #cc00cc;">#nav</span> li a <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; -webkit-transition<span style="color: #00AA00;">:</span> all 0.3s ease-out<span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></div>
</pre>
<p>It says <span style='color:#c7d0cf;' >&#8216;all&#8217;</span> animatable properties should animate over 300ms using <span style='color:#c7d0cf;' >&#8216;ease-out&#8217;</span>, similar to jQuerys easing functions.</p>
<p>Next we&#8217;ll add the styling for the anchor tags with some fancy <span style='color:#c7d0cf;' >-webkit-border-radius</span> and <span style='color:#c7d0cf;' >-webkit-box-shadow</span> to give it some shape and depth and complete it with a backgroung image for each item to enhance our interface effect, making them look like their coming from underneath the ridge.</p>
<pre>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ul<span style="color: #cc00cc;">#nav</span> li a <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; -webkit-transition<span style="color: #00AA00;">:</span> all 0.3s ease-out<span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#cbcbcb</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">border.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#174867</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">7px</span> <span style="color: #933;">15px</span> <span style="color: #933;">7px</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; -webkit-border-top-right-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; -webkit-border-bottom-right-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; -webkit-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">4px</span> <span style="color: #cc00cc;">#888</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></div>
</pre>
<p>The properties we&#8217;re going to style are <span style='color:#c7d0cf;' >color</span>, <span style='color:#c7d0cf;' >background-color</span> and <span style='color:#c7d0cf;' >left-padding</span> so let&#8217;s add them to the <span style='color:#c7d0cf;' >hover:</span> state.</p>
<pre>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ul<span style="color: #6666ff;">.nav</span> li a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ebebeb</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">border.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#67a5cd</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">7px</span> <span style="color: #933;">15px</span> <span style="color: #933;">7px</span> <span style="color: #933;">30px</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></div>
</pre>
<p>That&#8217;s about it really. No javascript and exactly the same effect. Probably be easy to make this degrade nicely for &#8220;certain&#8221; browsers. Now all you have to do is wait!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tobypitman.com/jquery-style-menu-with-css3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiple collapsable panels with cookies</title>
		<link>http://www.tobypitman.com/multiple-collapsable-panels-with-cookies/</link>
		<comments>http://www.tobypitman.com/multiple-collapsable-panels-with-cookies/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 12:30:36 +0000</pubDate>
		<dc:creator>Toby</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.tobypitman.com/?p=154</guid>
		<description><![CDATA[There's literally nothing about on the internet about using the jQuery toogle() function on multiple collapsable panels and saving their states with cookies from one page to another. This prompted me to try and write my own script to take care of the sidebar to the left of the screen.]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s literally nothing about on the internet about using the<a href="http://jquery.com"> jQuery</a> <a href="http://docs.jquery.com/Events/toggle">toogle()</a> function on multiple collapsable panels and saving their states with cookies from one page to another. This prompted me to try and write my own script to take care of <span style="color: #c7d0cf;">the sidebar to the left of the window</span>. All the separate panels are &#8216;widgets&#8217; in Wordpress and are loaded into an &#8216;li&#8217; tag with a class name of &#8216;widget&#8217; making it simple to target the items. I&#8217;d also like to say this isn&#8217;t an Accordion as such and even the scripts for them don&#8217;t deal with unique cookies!</p>
<h3>The collapsing effect</h3>
<p>Collapsing the panels is the easy bit and just like every other &#8216;accordion&#8217; and &#8216;collapsing panel&#8217; plug-in can be achived with a simple toogle() function to slide the &#8216;ul&#8217; inside each of the widgets when the &#8216;h2&#8242; is clicked. The jQuery for that would look like this&#8230;</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li.widget h2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toggle</span><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideUp</span><span style="color: #009900;">&#40;</span>500<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideDown</span><span style="color: #009900;">&#40;</span>500<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>Notice how we use <span style="color: #c7d0cf;">.next(&#8221;ul&#8221;)</span> to target the &#8216;ul&#8217; as it immediately precedes the &#8216;h2&#8242; which is the trigger for the effect. So far so good!</p>
<p>Next we need to add an &#8216;active&#8217; class to the &#8216;h2&#8242; on DOM ready so the user can see the state of the panels when the page loads, hopefully prompting them they can close it. When they click it we just remove the active &#8216;class&#8217;. This is really easy too by adding this&#8230;.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li.widget h2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;active&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Add the class on page load.</span><br />
<br />
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li.widget h2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toggle</span><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideUp</span><span style="color: #009900;">&#40;</span>500<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// Remove the class 'active' on slideUp</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideDown</span><span style="color: #009900;">&#40;</span>500<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;active&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// Add the class 'active' on slideDown</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>Here&#8217;s the CSS for the state change&#8230;.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">li.<span style="color: #660066;">widget</span> h2 <span style="color: #009900;">&#123;</span><br />
background<span style="color: #339933;">:</span>transparent url<span style="color: #009900;">&#40;</span>images<span style="color: #339933;">/</span>yourImage.<span style="color: #660066;">jpg</span><span style="color: #009900;">&#41;</span> no<span style="color: #339933;">-</span>repeat <span style="color: #000066;">scroll</span> right top<span style="color: #339933;">;</span><br />
<span style="color: #009966; font-style: italic;">/* various styling */</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
li.<span style="color: #660066;">widget</span> h2.<span style="color: #660066;">active</span> <span style="color: #009900;">&#123;</span><br />
background<span style="color: #339933;">-</span>position<span style="color: #339933;">:</span>right bottom<span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Pretty standard stuff! Now comes the interesting bits!</p>
<h3>Baking the cookies!</h3>
<p>First off I downloaded <a href="http://plugins.jquery.com/project/cookie">jQuery.cookies.js</a>. This is a great jQuery plug-in for dealing with cookie operations. The basics of it are&#8230;.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$.<span style="color: #660066;">cookie</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'COOKIE_NAME'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'COOKIE_VALUE'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span> path<span style="color: #339933;">:</span> <span style="color: #3366CC;">'/'</span><span style="color: #339933;">,</span> expires<span style="color: #339933;">:</span> 10 <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
<span style="color: #006600; font-style: italic;">//Make a cookie</span><br />
<br />
$.<span style="color: #660066;">cookie</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'COOKIE_NAME'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'null'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span> path<span style="color: #339933;">:</span> <span style="color: #3366CC;">'/'</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp;<span style="color: #006600; font-style: italic;">//Delete the cookie</span><br />
<br />
$.<span style="color: #660066;">cookie</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'COOKIE_NAME'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp;<span style="color: #006600; font-style: italic;">//Get the cookie. Returns cookie value.</span></div></div>
<p>The problem is that all the tutorials for collapsing panels with cookies only dealt with one panel!..and one cookie! But I have multiple panels that need to have their states saved in multiple individual cookies! As Clay Davis from &#8216;The Wire&#8217; would say,&#8221;<a href="http://uk.youtube.com/watch?v=JeaaFTNh3xY">SSSHHHIIIIIIIIIIIIIIIT</a>!&#8221;.</p>
<h3>Making unique cookies</h3>
<p>So&#8230;first I needed to find the index of the widget I&#8217;d collapsed and store it&#8217;s state in an it&#8217;s own unique cookie. Finding the index or number of the widget can be done with this line&#8230;</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li.widget h2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toggle</span><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> num <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li.widget h2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">index</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #006600; font-style: italic;">// Find the index of the widget. Starts at 0.</span><br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideUp</span><span style="color: #009900;">&#40;</span>500<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> num <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li.widget h2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">index</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #006600; font-style: italic;">// Find the index of the widget. Starts at 0.</span><br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideDown</span><span style="color: #009900;">&#40;</span>500<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;active&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #006600; font-style: italic;">//Clicking the first widget 'h2' trigger will store 0 in the variable 'num'.</span></div></div>
<p>Now we can create some variables to store unique cookie names and values. Here&#8217;s how we do that&#8230;.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> num <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li.widget h2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">index</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
<span style="color: #003366; font-weight: bold;">var</span> cookieName <span style="color: #339933;">=</span> <span style="color: #3366CC;">'panel'</span> <span style="color: #339933;">+</span> num<span style="color: #339933;">;</span> &nbsp;<br />
<span style="color: #006600; font-style: italic;">// Returns ----&gt; panel0, panel1, panel2 &nbsp;etc....</span><br />
<span style="color: #003366; font-weight: bold;">var</span> cookieValue <span style="color: #339933;">=</span> <span style="color: #3366CC;">'closed'</span> <span style="color: #339933;">+</span> num<span style="color: #339933;">;</span> &nbsp; <br />
<span style="color: #006600; font-style: italic;">// Returns ----&gt; closed0, closed1, closed2 &nbsp;etc.... </span><br />
<span style="color: #339933;">&lt;/</span>code<span style="color: #339933;">&gt;</span><br />
<span style="color: #339933;">&lt;/</span>pre<span style="color: #339933;">&gt;</span><br />
<br />
<span style="color: #339933;">&lt;</span>h3<span style="color: #339933;">&gt;</span>Create the cookies<span style="color: #339933;">&lt;/</span>h3<span style="color: #339933;">&gt;</span><br />
<br />
Now <span style="color: #000066; font-weight: bold;">for</span> every widget clicked we can create a unique cookie <span style="color: #000066; font-weight: bold;">with</span> a unique value. <br />
<span style="color: #660066;">Let</span><span style="color: #3366CC;">'s see how we set up the cookie...<br />
This creates a cookie for the first widget when it'</span>s clicked.<br />
<br />
<span style="color: #009900;">&#91;</span>cc lang<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;javascript&quot;</span><span style="color: #009900;">&#93;</span><br />
<span style="color: #003366; font-weight: bold;">var</span> num <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li.widget h2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">index</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Find index of 0.</span><br />
&nbsp; &nbsp; <br />
$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideUp</span><span style="color: #009900;">&#40;</span>500<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Slide up panel</span><br />
$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Remove 'active' class</span><br />
&nbsp; &nbsp; <br />
<span style="color: #003366; font-weight: bold;">var</span> cookieName <span style="color: #339933;">=</span> <span style="color: #3366CC;">'panel'</span> <span style="color: #339933;">+</span> num<span style="color: #339933;">;</span> &nbsp;<span style="color: #006600; font-style: italic;">// Returns ----&gt; panel0</span><br />
<span style="color: #003366; font-weight: bold;">var</span> cookieValue <span style="color: #339933;">=</span> <span style="color: #3366CC;">'closed'</span> <span style="color: #339933;">+</span> num<span style="color: #339933;">;</span> &nbsp; <span style="color: #006600; font-style: italic;">// Returns ----&gt; closed0 </span><br />
&nbsp; &nbsp; <br />
$.<span style="color: #660066;">cookie</span><span style="color: #009900;">&#40;</span>cookieName<span style="color: #339933;">,</span> cookieValue<span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span> path<span style="color: #339933;">:</span> <span style="color: #3366CC;">'/'</span><span style="color: #339933;">,</span> expires<span style="color: #339933;">:</span> 10 <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; <br />
<span style="color: #006600; font-style: italic;">// Cookie is stored as panel0 with a value of closed0.</span></div></div>
<h3>Deleting the cookies</h3>
<p>To delete the cookie when widget one is clicked or &#8216;toogled&#8217; we do this&#8230;..</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> num <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li.widget h2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">index</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Find index of 0.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideDown</span><span style="color: #009900;">&#40;</span>500<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Slide down panel</span><br />
$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;active&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #006600; font-style: italic;">// Add 'active' class &nbsp; &nbsp; </span><br />
&nbsp; &nbsp; <br />
<span style="color: #003366; font-weight: bold;">var</span> cookieName <span style="color: #339933;">=</span> <span style="color: #3366CC;">'panel'</span> <span style="color: #339933;">+</span> num<span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Returns ----&gt; panel0</span><br />
&nbsp; &nbsp; <br />
$.<span style="color: #660066;">cookie</span><span style="color: #009900;">&#40;</span>cookieName<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span> path<span style="color: #339933;">:</span> <span style="color: #3366CC;">'/'</span><span style="color: #339933;">,</span> expires<span style="color: #339933;">:</span> 10 <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; <br />
<span style="color: #006600; font-style: italic;">// Cookie with the name panel0 is deleted.</span></div></div>
<p>The whole code for this looks like this&#8230;..</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li.widget h2.active&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toggle</span><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> num <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li.widget h2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">index</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideUp</span><span style="color: #009900;">&#40;</span>500<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> cookieName <span style="color: #339933;">=</span> <span style="color: #3366CC;">'panel'</span> <span style="color: #339933;">+</span> num<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> cookieValue <span style="color: #339933;">=</span> <span style="color: #3366CC;">'closed'</span> <span style="color: #339933;">+</span> num<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $.<span style="color: #660066;">cookie</span><span style="color: #009900;">&#40;</span>cookieName<span style="color: #339933;">,</span> cookieValue<span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span> path<span style="color: #339933;">:</span> <span style="color: #3366CC;">'/'</span><span style="color: #339933;">,</span> expires<span style="color: #339933;">:</span> 10 <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> num <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li.widget h2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">index</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideDown</span><span style="color: #009900;">&#40;</span>500<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;active&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> cookieName <span style="color: #339933;">=</span> <span style="color: #3366CC;">'panel'</span> <span style="color: #339933;">+</span> num<span style="color: #339933;">;</span> &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; $.<span style="color: #660066;">cookie</span><span style="color: #009900;">&#40;</span>cookieName<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span> path<span style="color: #339933;">:</span> <span style="color: #3366CC;">'/'</span><span style="color: #339933;">,</span> expires<span style="color: #339933;">:</span> 10 <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<h3>Getting the cookie values</h3>
<p>Now we have to retrieve the cookies and their values to set the state of the widgets when the page is reloaded. This is easily achived using a <span style="color: #c7d0cf;">for</span> loop with an <span style="color: #c7d0cf;">if</span> statement inside it.</p>
<p>First were going to add a line to see how many widgets we have so we know how long the loop should be. I&#8217;ve also created a variable to define the &#8216;ul&#8217; as &#8216;panel&#8217;. If you have nested lists you may want to add <span style="color: #c7d0cf;">:first</span> to the selector.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> l <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'li.widget h2'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span><br />
<span style="color: #003366; font-weight: bold;">var</span> panel <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li.widget ul&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>I&#8217;ve done this for any widget that has a title or &#8216;h2&#8242; tag. Some widgets like &#8216;text&#8217; or &#8216;RSS&#8217; widgets you may want to leave out. This is optional&#8230;.</p>
<p>Heres the loop with some comments. c=0 is important it&#8217;s the loop index.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>c<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>c<span style="color: #339933;">&lt;=</span>l<span style="color: #339933;">;</span>c<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<span style="color: #006600; font-style: italic;">// Loop up to the number of widgets. l is the length.</span><br />
<br />
<span style="color: #003366; font-weight: bold;">var</span> cvalue <span style="color: #339933;">=</span> $.<span style="color: #660066;">cookie</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'panel'</span> <span style="color: #339933;">+</span> c<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp;<br />
<span style="color: #006600; font-style: italic;">// Store the value of found cookie in cvalue while looping.</span><br />
&nbsp; <br />
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> cvalue <span style="color: #339933;">==</span> <span style="color: #3366CC;">'closed'</span> <span style="color: #339933;">+</span> c <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; &nbsp; &nbsp;<br />
<span style="color: #006600; font-style: italic;">// If values match do this... </span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp; $<span style="color: #009900;">&#40;</span>panel<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">eq</span><span style="color: #009900;">&#40;</span>c<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>display<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;none&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #006600; font-style: italic;">// Hide the ul if cookie is found for element.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; $<span style="color: #009900;">&#40;</span>panel<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">eq</span><span style="color: #009900;">&#40;</span>c<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">prev</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'inactive'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #006600; font-style: italic;">// Change state of effect trigger.</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></div></div>
<p>If the loop finds a cookie with the name &#8216;panel0&#8242; it will return a value of &#8216;closed0&#8242; which tells the if statement to hide the widget &#8216;ul&#8217; with an index of 0 and remove the &#8216;active&#8217; class and add a class of &#8216;inactive&#8217; on page load.</p>
<p>When the page loads any widget that has an &#8216;h2&#8242; with the class &#8216;inactive&#8217; will be hidden as it doesn&#8217;t have the class  &#8216;active&#8217;&#8230;&#8230;.Great!</p>
<h3>Major Problem!!!</h3>
<p>&#8230;..or not! Just like Microsoft there is one massive flaw in this code!!! I&#8217;d like to add that up to here took about an hour, what follows took a whole day!</p>
<p>The toogle() function works on the premise that the first part of the code (the first &#8216;click&#8217; function) will slide the element UP and the second part (the second &#8216;click&#8217; on the element) will slide the element DOWN. Well what if the element is already UP on page load. Clicking the trigger returns nothing as the element is already UP&#8230;?!? You need to click it again to get it to slide down which from a UI point of veiw it pretty&#8230;well, crap!</p>
<p>I tried so many different things from &#8216;if else&#8217; statements to &#8216;click&#8217; functions, the list goes on. It seemed if one thing worked something else wouldn&#8217;t. It was like a dream that you&#8217;re chasing something but can never catch up with it. At one point I thought I was losing my mind!</p>
<p>The answer turned out to be really simple in the end (Doh!) an lay in something I&#8217;d added to the code but never thought of using&#8230; the &#8216;inactive&#8217; class. I discovered that if I duplicated the toggle() function and reversed the functions so the first click performed a DOWN slide and assigned that to <span style="color: #c7d0cf;">$(&#8217;li.widget h2.inactive&#8217;)</span> it produced the desired result. Not very elegant but then neither am I!</p>
<p>The whole thing looks like this&#8230;.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<br />
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li.widget h2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;active&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #003366; font-weight: bold;">var</span> l <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'li.widget h2'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #003366; font-weight: bold;">var</span> panel <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li.widget ul&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>c<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>c<span style="color: #339933;">&lt;=</span>l<span style="color: #339933;">;</span>c<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp;<span style="color: #003366; font-weight: bold;">var</span> cvalue <span style="color: #339933;">=</span> $.<span style="color: #660066;">cookie</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'panel'</span> <span style="color: #339933;">+</span> c<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <br />
&nbsp; &nbsp;<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> cvalue <span style="color: #339933;">==</span> <span style="color: #3366CC;">'closed'</span> <span style="color: #339933;">+</span> c <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span>panel<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">eq</span><span style="color: #009900;">&#40;</span>c<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>display<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;none&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span>panel<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">eq</span><span style="color: #009900;">&#40;</span>c<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">prev</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'inactive'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<br />
<br />
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li.widget h2.active&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toggle</span><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> num <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li.widget h2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">index</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> cookieName <span style="color: #339933;">=</span> <span style="color: #3366CC;">'panel'</span> <span style="color: #339933;">+</span> num<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> cookieValue <span style="color: #339933;">=</span> <span style="color: #3366CC;">'closed'</span> <span style="color: #339933;">+</span> num<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideUp</span><span style="color: #009900;">&#40;</span>500<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $.<span style="color: #660066;">cookie</span><span style="color: #009900;">&#40;</span>cookieName<span style="color: #339933;">,</span> cookieValue<span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span> path<span style="color: #339933;">:</span> <span style="color: #3366CC;">'/'</span><span style="color: #339933;">,</span> expires<span style="color: #339933;">:</span> 10 <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> num <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li.widget h2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">index</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> cookieName <span style="color: #339933;">=</span> <span style="color: #3366CC;">'panel'</span> <span style="color: #339933;">+</span> num<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideDown</span><span style="color: #009900;">&#40;</span>500<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;active&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; $.<span style="color: #660066;">cookie</span><span style="color: #009900;">&#40;</span>cookieName<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span> path<span style="color: #339933;">:</span> <span style="color: #3366CC;">'/'</span><span style="color: #339933;">,</span> expires<span style="color: #339933;">:</span> 10 <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<br />
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li.widget h2.inactive&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toggle</span><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> num <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li.widget h2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">index</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> cookieName <span style="color: #339933;">=</span> <span style="color: #3366CC;">'panel'</span> <span style="color: #339933;">+</span> num<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideDown</span><span style="color: #009900;">&#40;</span>500<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;active&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'inactive'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; &nbsp;&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; $.<span style="color: #660066;">cookie</span><span style="color: #009900;">&#40;</span>cookieName<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span> path<span style="color: #339933;">:</span> <span style="color: #3366CC;">'/'</span><span style="color: #339933;">,</span> expires<span style="color: #339933;">:</span> 10 <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> num <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li.widget h2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">index</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> cookieName <span style="color: #339933;">=</span> <span style="color: #3366CC;">'panel'</span> <span style="color: #339933;">+</span> num<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> cookieValue <span style="color: #339933;">=</span> <span style="color: #3366CC;">'closed'</span> <span style="color: #339933;">+</span> num<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideUp</span><span style="color: #009900;">&#40;</span>500<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $.<span style="color: #660066;">cookie</span><span style="color: #009900;">&#40;</span>cookieName<span style="color: #339933;">,</span> cookieValue<span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span> path<span style="color: #339933;">:</span> <span style="color: #3366CC;">'/'</span><span style="color: #339933;">,</span> expires<span style="color: #339933;">:</span> 10 <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>&nbsp; <br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<h3>Conclusion</h3>
<p>Multiple collapsable panels with cookie states for every unique panel. Awesome!!!</p>
<p>I hope somebody finds this useful and is spared the brain ache I went through. To coolest thing is as the demo relies on Wordpress&#8217; markup you can drop it straight into a theme your developing. I&#8217;m going to turn it into a plugin soon too (once I&#8217;ve figured out how to do that!). I&#8217;d love to hear if any knows of a better and more elegant way of doing this, so leave a comment if you do!</p>
<p>For a demo, look no further than the sidebar menu at the top of this page. Close some widgets and reload the page!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tobypitman.com/multiple-collapsable-panels-with-cookies/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>My Top 5 albums of 2008</title>
		<link>http://www.tobypitman.com/my-top-5-albums-of-2008/</link>
		<comments>http://www.tobypitman.com/my-top-5-albums-of-2008/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 22:51:07 +0000</pubDate>
		<dc:creator>Toby</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.tobypitman.com/?p=116</guid>
		<description><![CDATA[Well, I know it's not over just yet but unless Van Halen release a new album in the next two weeks this will be my list favorite longplayers for 2008.]]></description>
			<content:encoded><![CDATA[<p>Well, I know it&#8217;s not over just yet but unless Van Halen release a new album in the next two weeks this will be my list favorite longplayers for 2008. There&#8217;s a lot of good music out there and some you just don&#8217;t get to hear unless you want to trawl though lots of shit on MySpace till you find a gem! </p>
<p>Infact that&#8217;s what the fine folk over at <a href="http://augasm.us">augasm.us</a> do so you don&#8217;t have to! Came across this site a little while ago and if your into indie/alternative music with a slightly offbeat flavour this could be the site for you. I recommend checking it out!</p>
<p>So here we go&#8230;.At</p>
<h3>No5: Pendulum &#8211; In Silico</h3>
<p><img src="http://www.tobypitman.com/wp-content/uploads/2008/12/pendulum.jpg" alt="pendulum" title="pendulum" width="590" height="200" class="alignnone size-full wp-image-117" /></p>
<p>Great production and kickass drums! Two vital ingredients to a great record for me. This quasi Drum &#038; Bass/Punk/Pop album has some great songwiting and arranging as well as being a really interesting and polished programming/production masterpiece! Did I mention the kickass beats!</p>
<p><a class="youtube" href="http://uk.youtube.com/watch?v=zENtEumtyBI">The Other Side</a></p>
<h3>No 4: Goldfrapp &#8211; Seventh Tree</h3>
<p><img src="http://www.tobypitman.com/wp-content/uploads/2008/12/goldfrapp.jpg" alt="goldfrapp" title="goldfrapp" width="590" height="200" class="alignnone size-full wp-image-122" /></p>
<p>Goldfrapp have always been a favorite of mine. The combination of Alison Goldfrapp&#8217;s smooth vocals and Will Gregory&#8217;s production and arranging are a match made in heaven. Nuff said!</p>
<p><a class="youtube" href="http://uk.youtube.com/watch?v=yJ8VyukQtTg">Caravan Girl</a></p>
<h3>No 3: Paul Gilbert &#8211; Silence followed by a Deafening Roar</h3>
<p><img src="http://www.tobypitman.com/wp-content/uploads/2008/12/paul-gilbert.jpg" alt="paul-gilbert" title="paul-gilbert" width="590" height="200" class="alignnone size-full wp-image-124" /></p>
<p>Former Racer X and Mr Big guitarist Paul Gilbert returns without the singing and just does what he does best. Play amazing, over the top guitar! A lot more funky with some 70&#8217;s rock flavours this is a great guitar record. And a bloody nice chap with it!</p>
<p><a class="youtube" href="http://uk.youtube.com/watch?v=eR2gCAO2CRY">Norwegian Cowbell</a></p>
<h3>No 2: Wallis Bird &#8211; Spoons</h3>
<p><img src="http://www.tobypitman.com/wp-content/uploads/2008/12/wallis-bird.jpg" alt="wallis-bird" title="wallis-bird" width="590" height="200" class="alignnone size-full wp-image-125" /></p>
<p>Wallis Bird from Ireland plays guitar left-handed not because she&#8217;s left-handed but because she got all her fingers chopped off on her left hand ( she got them put back on! ). It doesn&#8217;t seem to have stopped her though as she&#8217;s one of the tightest acoustic rhythm guitarists I&#8217;ve heard in a while. That aside, she has the knack of writing really catchy songs and an awesome voice too! &#8216;Spoons&#8217; is so infectious as an album with it&#8217;s mixture of folk and pop ( and even a hint of prog! ) it&#8217;s hard to stop listening to it! A breathe of fresh air! 5 Stars!!! Thanks <a href="http://aurgasm.us">Aurgasm</a>!!!</p>
<p><a class="youtube" href="http://uk.youtube.com/watch?v=U6ugZViX3yU">Blossoms in the Street</a><br />
<a class="youtube" href="http://uk.youtube.com/watch?v=OGinf4hmbeg">Interview</a></p>
<h3>No 1: Everything by The Bird and the Bee&#8230;.ever!</h3>
<p><img src="http://www.tobypitman.com/wp-content/uploads/2008/12/bird-bee.jpg" alt="bird-bee" title="bird-bee" width="590" height="200" class="alignnone size-full wp-image-127" /></p>
<p>When I first heard &#8216;Again &#038; Again&#8217; by The Bird and the Bee I thought it was the catchiest song I&#8217;d ever heard. I immediatly bought all their records and they&#8217;ve been on loop ever since. Consisting of Inara George ( I only found out after that Inara is the daughter of one of my all time heroes Lowell George from &#8216;Little Feat&#8217; ) and pianist and producer Greg Kurstin. A totally magical mix of Jazz/Electro/Pop meets Burt Bacharach the Bird and the Bee just couldn&#8217;t be any cooler if they tried. Do yourself a favour and have a listen. If you like great pop music then the Bird and the Bee have it all!!!</p>
<p><a class="youtube" href="http://uk.youtube.com/watch?v=xDlEXQaMBpk">Again &#038; Again (2007)</a><br />
<a class="youtube" href="http://uk.youtube.com/watch?v=nI3g9RaVkdY">Polite Dance Song</a><br />
<a class="youtube" href="http://uk.youtube.com/watch?v=drhFLc3Jm48">La La La</a></p>
<h3>Honorable Mentions&#8230;.</h3>
<p><img src="http://www.tobypitman.com/wp-content/uploads/2008/12/consolers.jpg" alt="consolers" title="consolers" width="70" height="70" class="alignleft size-full wp-image-129" style="padding-top:10px;"/></p>
<h3>The Racontuers &#8211; Consolers of the Lonely</h3>
<p>Jack White and co provide some kickass grooves and some of the best guitar sounds ever put to tape. He really is a very talented bloke!<br/><br/></p>
<p><img src="http://www.tobypitman.com/wp-content/uploads/2008/12/greg-howe.jpg" alt="greg-howe" title="greg-howe" width="70" height="69" class="alignleft size-full wp-image-134"  style="padding-top:10px;"/></p>
<h3>Greg Howe &#8211; Sound Proof</h3>
<p>Took a while to get into but now I&#8217;m there. Served as a reminder that you&#8217;ll never be as good as Greg Howe!<br/><br/></p>
<p><img src="http://www.tobypitman.com/wp-content/uploads/2008/12/brent-mason.jpg" alt="brent-mason" title="brent-mason" width="70" height="70" class="alignleft size-full wp-image-135"  style="padding-top:10px;"/></p>
<h3>Brent and Randy Mason &#8211; Smoking Section</h3>
<p>&#8230;.Unless your Brent Mason! Nashvilles top session guitarist more than delivers with a mix of Western Swing/Country/Jazz and Blues. Totally baffling!!!<br/><br/></p>
<p><img src="http://www.tobypitman.com/wp-content/uploads/2008/12/angles.jpg" alt="angles" title="angles" width="70" height="68" class="alignleft size-full wp-image-142" style="padding-top:10px;"/></p>
<h3>Dan Le Sac vs Scroobius Pip &#8211; Angles</h3>
<p>Left field british Electro/Hip Hop. Totally mental but really inventive production and lyrics. Stand out track <a href="http://uk.youtube.com/watch?v=yqnKbdqjh2I">&#8216;Look for the Woman&#8217;</a><br/><br/></p>
<p><a class="youtube" href="http://uk.youtube.com/watch?v=LSzA1kmH58U">Dan Le Sac Vs Scroobius Pip Look For The X-Factor</a> Hilarious&#8230;!!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tobypitman.com/my-top-5-albums-of-2008/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JQuery: Fade elements sequencially without chaining</title>
		<link>http://www.tobypitman.com/jquery-fade-elements-sequencially-without-chaining/</link>
		<comments>http://www.tobypitman.com/jquery-fade-elements-sequencially-without-chaining/#comments</comments>
		<pubDate>Sat, 13 Dec 2008 20:07:13 +0000</pubDate>
		<dc:creator>Toby</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.tobypitman.com/?p=98</guid>
		<description><![CDATA[Here's a useful trick for fading similar elements sequencially without having to chain the effects. In the first example I have 5 divs that I want to fade in one after the other. Instead of giving them all unique ID's and chaining the fade effects like this....]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a useful trick for fading similar elements sequencially without having to chain the effects. In the first example I have 5 divs that I want to fade in one after the other. Instead of giving them all unique ID&#8217;s and chaining the fade effects like this&#8230;.<br />
<br/></p>
<pre>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$(&quot;#box1&quot;).fadeIn(&quot;slow&quot;, function(){<br />
&nbsp; $(&quot;#box2&quot;).fadeIn(&quot;slow&quot;, function(){<br />
&nbsp; &nbsp; $(&quot;#box3&quot;).fadeIn(&quot;slow&quot;, function(){<br />
&nbsp; &nbsp; &nbsp; $(&quot;#box4&quot;).fadeIn(&quot;slow&quot;, function(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; $(&quot;#box5&quot;).fadeIn(&quot;slow&quot;);<br />
&nbsp; &nbsp; &nbsp; });<br />
&nbsp; &nbsp; &nbsp;});<br />
&nbsp; &nbsp;});<br />
});</div></div>
</pre>
<p><br/><br />
&#8230;&#8230; you can instead give them a class of &#8216;box&#8217; and find the amount using <span style=color:#fff;>.length;</span> and use an <span style=color:#fff;>if</span> statement to loop through the until all the relevant elements are visible using a callback function.<br />
<br/></p>
<pre>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">var i = 0<br />
var n = $(&quot;.box&quot;).length;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
function showbox() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; if(i &lt;= n){ <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; $(&quot;.box&quot;).eq(i).fadeIn(600, function(){ i++; showbox(); });<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; } showbox();</div></div>
</pre>
<p><br/><br />
It&#8217;s a lot more efficient code wise and produces the same effect. Here&#8217;s the same thing but using a &#8216;click&#8217; event to trigger the function.<br />
<br/></p>
<pre>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">var j = 0<br />
var a = $(&quot;.list&quot;).length;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; $(&quot;#trigger&quot;).click(function showlist(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; if(j &lt;= a){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; $(&quot;.list&quot;).eq(j).fadeIn(200, function(){ j++; showlist(); });<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}&nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; });</div></div>
</pre>
<p><br/><br />
Might be a nice effect for a menu? I was going to use it to fade in the posts on the blog homepage but IE7 can&#8217;t render one transparent PNG over another when faded. It comes out looking like a jaged GIF with the top PNG&#8217;s transparent pixel looking black instead. Once again IE ruins everything!!!</p>
<p><a class="viewdemo" href="http://development.tobypitman.com/jquery/sequence.html" title="">View Demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tobypitman.com/jquery-fade-elements-sequencially-without-chaining/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Producing Johnny Borrell&#8217;s &#8216;Carrickfergus&#8217;</title>
		<link>http://www.tobypitman.com/producing-johnny-borrells-carrickfergus/</link>
		<comments>http://www.tobypitman.com/producing-johnny-borrells-carrickfergus/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 18:16:16 +0000</pubDate>
		<dc:creator>Toby</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Studio]]></category>

		<guid isPermaLink="false">http://www.tobypitman.com/?p=51</guid>
		<description><![CDATA[Completely forgot about this one! In August Air Studios engineer Nick Cervonaro asked me if I would help him out with a charity project Bruce Parry ( from the BBC's brilliant 'Tribe' series  ) was putting together for Survival International.]]></description>
			<content:encoded><![CDATA[<p>Completely forgot about this one! In August Air Studios engineer Nick Cervonaro asked me if I would help him out with a charity project Bruce Parry ( from the BBC&#8217;s brilliant &#8216;Tribe&#8217; series  ) was putting together for Survival International.<span id="more-51"></span></p>
<p>I was asked to do some arranging on the Johnny Borrell ( Razorlight ) track &#8216;Carrickfurgus&#8217; which was in the demo stage at the time. Nick had the files which were in a pretty basic state with some loops and a vocal track and a rough sketch of the chords.</p>
<p><img class="alignnone size-full wp-image-52" title="Nick Ceronavo" src="http://www.tobypitman.com/wp-content/uploads/2008/12/p1000099.jpg" alt="" width="518" height="186" /></p>
<p>We eventually decided to re-record the entire track and just keep the vocal and ended up co-producing the track together. Nick took care of the engineering and mixing duties and I arranged the music and eventually ended up playing or programming all the instrumentation!</p>
<p><img class="alignnone size-full wp-image-53" title="Doing some Acoustic guitars" src="http://www.tobypitman.com/wp-content/uploads/2008/12/p1000110.jpg" alt="" width="518" height="278" /></p>
<p>The whole thing was done in one day from start to finish in Studio 2 at Air.</p>
<p><img class="alignnone size-full wp-image-54" title="Are my guitars loud enough?" src="http://www.tobypitman.com/wp-content/uploads/2008/12/p1000139.jpg" alt="" width="518" height="326" /></p>
<p>It was only the fact I saw the track in my inbox that I remembered it. I went on iTunes and sure enough there it was. The album features tracks from KT Tunstall, Yusif Islam, Hot Chip, The Go! Team and Will.i.am to name a few. It&#8217;s called Amazon Tribe &#8211; Songs for Survival and is available from all good music retailers.</p>
<p>On a guitar note, I used my fantastic <a href="http://www.atkinguitars.com/">Atkin</a> &#8216;Dreadnought&#8217; for the acoustics ( and percussion! ) and my Telecaster though an old Vox AC30 with a <a href="http://www.jimdunlop.com/index.php?page=products/pip&amp;id=264&amp;pmh=products/p_and_e_detail">Custom Audio Electronics boost pedal by MXR</a> for the electrics.</p>
<p><img class="alignnone size-full wp-image-55" title="mmmmmm! Vox" src="http://www.tobypitman.com/wp-content/uploads/2008/12/p1000123.jpg" alt="" width="518" height="289" /></p>
<p>Go out and buy it, it&#8217;s for a good cause! Did I mention we all did it for free!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tobypitman.com/producing-johnny-borrells-carrickfergus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
