<?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/"
	>

<channel>
	<title>Martini Lab Blog</title>
	<atom:link href="http://www.martinilab.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.martinilab.com/blog</link>
	<description>Web design, CSS, scripting, Adobe, tips and other scraps of things that come my way</description>
	<pubDate>Tue, 21 Jul 2009 23:05:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Introducing thevariants.com</title>
		<link>http://www.martinilab.com/blog/155/introducing-thevariantscom/</link>
		<comments>http://www.martinilab.com/blog/155/introducing-thevariantscom/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 22:58:17 +0000</pubDate>
		<dc:creator>Chris Williams</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<category><![CDATA[clients]]></category>

		<category><![CDATA[css]]></category>

		<category><![CDATA[funny]]></category>

		<category><![CDATA[html]]></category>

		<category><![CDATA[WordPress]]></category>

		<category><![CDATA[YouTube]]></category>

		<guid isPermaLink="false">http://www.martinilab.com/blog/?p=155</guid>
		<description><![CDATA[
The Variants is a new web series sitcom about the crew of a local comic shop.  So far, four promos have been produced and released in time for SDCC 2009 and Episode one is scheduled for release.  Each episode (or is it webisode) runs about ten minutes.
Putting this together was a lot of [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.thevariants.com/"><img src="http://www.martinilab.com/blog/wp-content/uploads/2009/07/thevariants-thumb.png" alt="thevariants-thumb" title="thevariants-thumb" width="300" height="252" class="alignright size-full wp-image-156" /></a></p>
<p>The Variants is a new web series sitcom about the crew of a local comic shop.  So far, four promos have been produced and released in time for SDCC 2009 and Episode one is scheduled for release.  Each episode (or is it webisode) runs about ten minutes.</p>
<p>Putting this together was a lot of fun.  With internet video content rising well beyond YouTube, I had many examples of what people expect from a media web site.  Plus, I got to work in a little bit of html5 semantics.</p>
<p>Go watch <a href="http://www.thevariants.com">The Variants</a> promos and laugh, laugh and laugh.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinilab.com/blog/155/introducing-thevariantscom/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Introducing scribbr.com</title>
		<link>http://www.martinilab.com/blog/149/introducing-scribbrcom/</link>
		<comments>http://www.martinilab.com/blog/149/introducing-scribbrcom/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 22:51:26 +0000</pubDate>
		<dc:creator>Chris Williams</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Design]]></category>

		<category><![CDATA[canvas]]></category>

		<category><![CDATA[CodeIgniter]]></category>

		<category><![CDATA[html]]></category>

		<category><![CDATA[jQuery]]></category>

		<category><![CDATA[twitter]]></category>

		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://www.martinilab.com/blog/?p=149</guid>
		<description><![CDATA[
Scribbr is a tiny web app for drawing and posting to twitter.   With jQuery, the user can control the color, size, opacity of the cursor to draw on the canvas element 320 x 320 in size.
Last summer, I had the opportunity to work with Eisner Award winning cartoonist Scott Kurtz of PVP. During [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://scribbr.com/status/laprincessatx/2i"><img src="http://www.martinilab.com/blog/wp-content/uploads/2009/06/2i-150x150.png" alt="Thanks, Lisa!" title="Thanks, Lisa!" width="150" height="150" class="alignright size-thumbnail wp-image-150" /></a></p>
<p><a href="http://scribbr.com">Scribbr</a> is a tiny web app for drawing and posting to twitter.   With jQuery, the user can control the color, size, opacity of the cursor to draw on the <code>canvas</code> element 320 x 320 in size.</p>
<p>Last summer, I had the opportunity to work with Eisner Award winning cartoonist Scott Kurtz of <a href="http://www.pvponline.com">PVP</a>. During one conversation we had, he came up with a punch-line to what we were talking about.  I don&#8217;t remember what the subject was, but the punch-line involved a mock editorial cartoon.  He grabbed a 2&#8243; x 2&#8243; sticky note pad and drew the cartoon.  We had a laugh.</p>
<p>This would never happen online.  At least, not in any convenient, simple, method that I was aware of.</p>
<p>Right now, it&#8217;s very crude.  The controls are, admittedly, non-intuitive. There is no &#8216;Undo&#8217; other than clearing the canvas and starting over. It doesn&#8217;t support older browsers either.</p>
<p>I&#8217;m actually quite okay with that last part. This site was immensely fun to build. Getting it to work on IE6 would have taken away from that.  Right now, I know that it works on FireFox 3.0, Safari 4.0b (or WebKit nightly build), and Google Chrome 2.0.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinilab.com/blog/149/introducing-scribbrcom/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Zeus Comics redesign</title>
		<link>http://www.martinilab.com/blog/133/zeus-comics-redesign/</link>
		<comments>http://www.martinilab.com/blog/133/zeus-comics-redesign/#comments</comments>
		<pubDate>Fri, 22 May 2009 12:42:22 +0000</pubDate>
		<dc:creator>Chris Williams</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<category><![CDATA[clients]]></category>

		<category><![CDATA[CodeIgniter]]></category>

		<category><![CDATA[ecommerce]]></category>

		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://www.martinilab.com/blog/?p=133</guid>
		<description><![CDATA[If for no other reason than finally consolidating the past five years of css style changes into some semblance of organization, this redesign was a long time coming.  
Zeus Comics and Collectibles is an award-winning comic book retail store in Dallas, Texas. For almost nine years, Zeus has been serving the needs of the [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_136" class="wp-caption alignright" style="width: 310px"><a href="http://www.zeuscomics.com"><img src="http://www.martinilab.com/blog/wp-content/uploads/2009/05/zeus2009.jpg" alt="Zeus Comics" title="Zeus Comics" width="300" height="225" class="size-full wp-image-136" /></a><p class="wp-caption-text">Zeus Comics new design went live Thursday</p></div>
<p>If for no other reason than finally consolidating the past five years of css style changes into some semblance of organization, this redesign was a long time coming.  </p>
<p><a href="http://www.zeuscomics.com">Zeus Comics and Collectibles</a> is an award-winning comic book retail store in Dallas, Texas. For almost nine years, Zeus has been serving the needs of the comic book reading community in the DFW area in the only manner one can expect from a locally gay-owned business – fabulously!<br />
<span id="more-133"></span><br />
Since its last redesign, when Zeus won the <a href="http://www.comic-con.org/cci/cci_eisners_spirit_06zeuscomics.shtml">Will Eisner Spirit of Comics Retailing Award</a> in 2006, design trends evolved, and how we organize and display our code has matured. Zeus went through many attempts at integrating its point-of-sale system with an ecommerce solution.  I’m embarrassed to admit, its first version, not having any experience in ecommerce (how hard could it be?) used FileMaker Pro and Lasso. Looking back, I’m stunned by some on my coding and design decisions. Some of which locked the site into arcane structures from which are not easily broken. And some still exist.</p>
<p>The old method for adding something to the site was simple—make a new folder and add some new tables and call it good.  Want a forum? Install Aterr. Want a checklist? Add a new CodeIgniter folder. After all, what’s one more, right?  After a while, we ended up with many little systems and no way to support them all.</p>
<p>The site’s design needed consistency from its previous version as well. Too dramatic a departure and it loses its branding. We weren’t looking for a fresh start, just a face lift (with enough skin for more adjusting later).</p>
<p>Our approach to ecommerce was simple: always be closing.   One of the lessons learned from out previous cart solution was the more steps a customer has to take to complete an order, the more likely we’d lose the sale.  When you go into a retail store to buy a comic, you don’t expect to be a member of that shop.  When was the last time you walked up to a counter to pay for your goods to have the clerk ask for you username and password. I don’t have a user name. I just want to buy this book.</p>
<p>This was how our previous cart worked.  And I’ll say this first, after trying out X-cart, Zen Cart, Squirrel Cart and later Magento Commerce, Shop Script was the only solution with the simplest way for us to control data from our point-of-sale source. After adding all the items to the cart, the user would have to create an account, add records to the address book for both shipping and billing, choose those records and add them to the order, and then they could finalize their purchase.</p>
<p>In the current system, we’ve taken out the need for membership.  We don’t need it.  We don’t really want it.  We certainly don’t want to support it, if a customer forgets their password.  Instead, customers get a tracking key upon return from Paypal.  We don’t want your credit card info either.</p>
<p>In the next few weeks, I hope to have a downloadable version of the ecommerce solution, so stay tuned.</p>
<p>Is zeuscomics.com all done now? Hardly. Out of the gate, I’m already tracking new errors plus some old ones that will be address by the next release. Fortunately, one of the design/coding goals was to be able to change and grow the site as needed.  Stay tuned for that too.</p>
<p><a href="http://www.zeuscomics.com">http://www.zeuscomics.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinilab.com/blog/133/zeus-comics-redesign/feed/</wfw:commentRss>
		</item>
		<item>
		<title>YouTube’s H.264 turnaround time is the new dial up</title>
		<link>http://www.martinilab.com/blog/128/youtube-h264-turnaround-time/</link>
		<comments>http://www.martinilab.com/blog/128/youtube-h264-turnaround-time/#comments</comments>
		<pubDate>Thu, 21 May 2009 16:40:15 +0000</pubDate>
		<dc:creator>Chris Williams</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<category><![CDATA[Apple]]></category>

		<category><![CDATA[content]]></category>

		<category><![CDATA[scalability]]></category>

		<category><![CDATA[usability]]></category>

		<category><![CDATA[YouTube]]></category>

		<guid isPermaLink="false">http://www.martinilab.com/blog/?p=128</guid>
		<description><![CDATA[Just how long does it take for a YouTube video to become available on the YouTube iPhone app?
Seriously, if YouTube accepts .wmv, .avi, .mkv, .mov, .mpeg, .mp4, .flv, .ogg, 3gp and outputs to multiple .flv, mp4, 3gp… OMG, why then is the link I just tapped not available?
I understand that once uploaded, videos take time [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_129" class="wp-caption alignright" style="width: 215px"><a href="http://www.martinilab.com/blog/wp-content/uploads/2009/05/twitterific-youtube-fail.jpg"><img src="http://www.martinilab.com/blog/wp-content/uploads/2009/05/twitterific-youtube-fail.jpg" alt="Twitterific -&gt; YouTube -&gt; Fail" title="twitterific-youtube-fail" width="205" height="430" class="size-full wp-image-129" /></a><p class="wp-caption-text">Twitterific -> YouTube -> Fail</p></div>
<p>Just how long does it take for a YouTube video to become available on the YouTube iPhone app?</p>
<p>Seriously, if YouTube accepts .wmv, .avi, .mkv, .mov, .mpeg, .mp4, .flv, .ogg, 3gp and outputs to multiple .flv, mp4, 3gp… OMG, why then is the link I just tapped not available?</p>
<p>I understand that once uploaded, videos take time to convert for display. Having uploaded some from my own iMovie library, waiting for YouTube to do its magic without a progress bar is torture.  But once it’s done and properly playing on the website, the video still has to become available for HD (if available), mobile, etc.</p>
<p>As we become more connected on more networks on new devices, our content experience should become more homogeneous. Websites should get closer to looking the same on our desktop computers as they do our mobile devices. Instead, because of mobile phones and netbooks (more specifically, their wireless connectivity) web designers, who once enjoyed building for higher display resolutions and bigger bandwidth, find themselves thrown back into building sites that are “dial-up” friendly.  It’s a whole new browser war sans Netscape Navigator.</p>
<p>Which brings me back to YouTube on the iPhone. Video codec H.264, briefly put, is designed for both high-def and small bandwidth playback.  Since YouTube offers multiple versions of the same video, it has to take the original video upload and convert it several times. And since the only way to view YouTube on Apple TV or the iPhone is with h.264, YouTube needs to make additional conversions/transcodings.</p>
<p>In the end, content for the web isn’t just for the browser.  It includes phones, game consoles, dvr (TiVo), and any future devices we don’t yet know we need.  And all of them need the same content in their own specific formats.</p>
<p>All of this means that the next time I see something along the lines of “@amboy00: too funny! http://tinyurl.com/pqhugm,” I’ll probably have to wait until I get back to my desk to see the funny.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinilab.com/blog/128/youtube-h264-turnaround-time/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Fun with WebKit css gradients</title>
		<link>http://www.martinilab.com/blog/104/fun-with-webkit-css-gradients/</link>
		<comments>http://www.martinilab.com/blog/104/fun-with-webkit-css-gradients/#comments</comments>
		<pubDate>Fri, 15 May 2009 21:38:52 +0000</pubDate>
		<dc:creator>Chris Williams</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[css]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[usability]]></category>

		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://www.martinilab.com/blog/?p=104</guid>
		<description><![CDATA[As a follow up to yesterday’s woeful tale of using WebKit’s proprietary css properties, I wanted to follow up with a couple examples of how one can use these features without getting all “bevel-ly”
The only benefit of text-shadow is not downloading graphics for what can be expressed in css.  The same goes for -webkit-border-image, [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_108" class="wp-caption alignright" style="width: 110px"><a href="http://www.martinilab.com/blog/wp-content/uploads/2009/05/album.png"><img src="http://www.martinilab.com/blog/wp-content/uploads/2009/05/album.png" alt="Queen Album Cover" title="Killer WebKit" width="100" height="100" class="size-full wp-image-108" /></a><p class="wp-caption-text">Killer WebKit</p></div>
<p>As a follow up to yesterday’s <a href="http://www.martinilab.com/blog/91/webkit-background-clip-problem/">woeful tale</a> of using WebKit’s proprietary css properties, I wanted to follow up with a couple examples of how one can use these features without getting all “bevel-ly”</p>
<p>The only benefit of <code>text-shadow</code> is not downloading graphics for what can be expressed in css.  The same goes for <code>-webkit-border-image</code>, <code>-webkit-gradient</code>, <code>-moz-border-radius</code>, anything that keeps a web designer from having to launch Photoshop is a boon to bandwidth.</p>
<p>Here are two examples of using some WebKit css gradients.*</p>
<p><em>Update: You must have the Chrome 2.0 or Safari 4.b for these to work.</em></p>
<p><a href='http://www.martinilab.com/blog/wp-content/uploads/2009/05/album.html'>Example 1</a>. is brought to you by “Killer Queen”</p>
<p>This similar looking display to that of the iPhone album display uses a radial gradient (opposed to a linear) as the background for the track names. The overall effect is a dim light. The odd numbered tracks also use a gradient to take advantage of <code>-webkit-gradient</code>&rsquo;s support of alpha values.</p>
<p><a href='http://www.martinilab.com/blog/wp-content/uploads/2009/05/calendar.html'>Example 2</a>. is a css calendar.</p>
<p>This one combines linear gradients and javascript arrays.  Because <code>-webkit-gradient</code> can use rbga formatting in place of the usual hexadecimal value, calculating the values from color to another was much easier.</p>
<p>The drawback to these browser specific properties are, well, browser specific.  While adding a gradient value to your <code>div id=wrapper</code> might give it a groovy drop shadow effect on Safari, nothing is happening on either Firefox, and much less for IE.  </p>
<p>The workaround at this point is to browser detect.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>jQuery.<span style="color: #660066;">browser</span>.<span style="color: #660066;">safari</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#wrapper'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'problem-solved'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#wrapper'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'wah-wah-wah'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Or whatever.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinilab.com/blog/104/fun-with-webkit-css-gradients/feed/</wfw:commentRss>
		</item>
		<item>
		<title>-webkit-background-clip Problems</title>
		<link>http://www.martinilab.com/blog/91/webkit-background-clip-problem/</link>
		<comments>http://www.martinilab.com/blog/91/webkit-background-clip-problem/#comments</comments>
		<pubDate>Thu, 14 May 2009 18:07:23 +0000</pubDate>
		<dc:creator>Chris Williams</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[css]]></category>

		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://www.martinilab.com/blog/?p=91</guid>
		<description><![CDATA[Someday, all the nifty Photoshop Blending options will be available as CSS properties.  Mark my words! In the mean time, we’re kind of stuck with drop shadows, and now gradients (and text strokes) for WebKit browsers. Too bad you can’t use them together.
In order to take advantage of the background clipping, the color needs [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_94" class="wp-caption alignright" style="width: 160px"><a href="http://www.martinilab.com/blog/wp-content/uploads/2009/05/thumbnail_29708.jpg"><img src="http://www.martinilab.com/blog/wp-content/uploads/2009/05/thumbnail_29708-150x150.jpg" alt="Specimen 7" title="thumbnail_29708" width="150" height="150" class="size-thumbnail wp-image-94" /></a><p class="wp-caption-text">Specimen 7</p></div>
<p>Someday, all the nifty Photoshop Blending options will be available as CSS properties.  Mark my words! In the mean time, we’re kind of stuck with drop shadows, and now gradients (and <a href="http://webkit.org/blog/85/introducing-text-stroke/">text strokes</a>) for WebKit browsers. Too bad you can’t use them together.</p>
<p>In order to take advantage of the background clipping, the color needs to be transparent.  First off, that pretty much ruins any other browser from displaying text.  So this is only useful to Safari users (not even the iPhone currently supports it).  In Photoshop, you can get around having a transparent color and still having a drop shadow by setting that layers Fill Opacity to 0% while the layers opacity at 100%.</p>
<p>Also, using this technique has some odd behavior with padding. In my example, I couldn’t set padding to the parent div without the effect inheriting that padding.  Restating the padding didn’t affect it either.</p>
<p>Here is the example: <a href='http://www.martinilab.com/blog/wp-content/uploads/2009/05/webkit-background-clip.html'>webkit-background-clip.html</a></p>
<p>Now, you can add the <code>-webkit-text-stroke</code> and that will work with <code>text-shadow</code>, but only on the stroke and not the text.  I’ve yet to find an example that uses all three without looking like one of Superjail’s Doctor’s <a href=" http://superjail.wordpress.com/2008/10/13/specimen-7/">genetic experiments</a>.</p>
<p>Perhaps it is for the best, getting these to work together might have been the next <code>blink</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinilab.com/blog/91/webkit-background-clip-problem/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Twitshirt = Me all over your chest</title>
		<link>http://www.martinilab.com/blog/83/twitshirt-me-all-over-your-chest/</link>
		<comments>http://www.martinilab.com/blog/83/twitshirt-me-all-over-your-chest/#comments</comments>
		<pubDate>Thu, 07 May 2009 18:55:20 +0000</pubDate>
		<dc:creator>Chris Williams</dc:creator>
		
		<category><![CDATA[Misc]]></category>

		<category><![CDATA[ecommerce]]></category>

		<category><![CDATA[funny]]></category>

		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.martinilab.com/blog/?p=83</guid>
		<description><![CDATA[Some of the things best left unsaid, yet said anyway, have ways of coming back to haunt you.  But at least you get a $1 commision from it.
Twitshirts by Amboy00 (that&#8217;s me!)
]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.martinilab.com/blog/wp-content/uploads/2009/05/twitshirt.jpg" alt="twitter tee shirt caption" title="twitshirt" width="401" height="209" class="size-full wp-image-82" /><br />
Some of the things best left unsaid, yet said anyway, have ways of coming back to haunt you.  But at least you get a $1 commision from it.</p>
<p><a href="http://twitshirt.com/amboy00">Twitshirts by Amboy00</a> (that&#8217;s me!)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinilab.com/blog/83/twitshirt-me-all-over-your-chest/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Tackling Safari&#8217;s slow gif &#8220;feature&#8221; with jQuery</title>
		<link>http://www.martinilab.com/blog/75/tackling-safaris-slow-gif-feature-with-jquery/</link>
		<comments>http://www.martinilab.com/blog/75/tackling-safaris-slow-gif-feature-with-jquery/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 23:19:36 +0000</pubDate>
		<dc:creator>Chris Williams</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Design]]></category>

		<category><![CDATA[adobe]]></category>

		<category><![CDATA[Apple]]></category>

		<category><![CDATA[hacks]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[jQuery]]></category>

		<category><![CDATA[Photoshop]]></category>

		<category><![CDATA[tips]]></category>

		<category><![CDATA[usability]]></category>

		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://www.martinilab.com/blog/?p=75</guid>
		<description><![CDATA[Safari&#8217;s WebKit has a funny behavior of displaying animated gif files at a lower frame rate than Firefox. From what I can tell, WebKit (including Google Chrome) caps the animated gif frame rates at 10fps. While it may be faster than some IE6 browsers, it&#8217;s not exactly helpful for those files with higher frame rates.
For [...]]]></description>
			<content:encoded><![CDATA[<p>Safari&#8217;s WebKit has a funny behavior of displaying animated gif files at a lower frame rate than Firefox. From what I can tell, WebKit (including Google Chrome) caps the animated gif frame rates at 10fps. While it may be faster than some IE6 browsers, it&#8217;s not exactly helpful for those files with higher frame rates.</p>
<p>For example, the popular ajax loader file that hails from Apple&#8217;s own <a href="http://developer.apple.com/documentation/userexperience/Conceptual/AppleHIGuidelines/XHIGControls/XHIGControls.html">asynchronous progress indicator</a>, has 12 points and loops around once a second.  Well, for one thing, 12fps is really choppy (so I&#8217;ve <a href="http://www.martinilab.com/blog/pages/animatedgif/images/ajax-loader.gif">made</a> the fading spokes a little more smoother at 24pfs), but it already plays slower on Apple&#8217;s nifty browser.</p>
<h2>jQuery to the rescue</h2>
<p>Did you know that jQuery can control css background positions? Are you thinking what I&#8217;m thinking?<br />
<span id="more-75"></span></p>
<h2>But first, back to drawing board</h2>
<p>So the first part was to break up the animated gif frames and spread them out across a very long canvas. Since Photoshop no longer opens animated gif files (unless you own ImageReady somewhere), Fireworks can open the file. Use Fireworks to export the frames to individual files and THEN Photoshop can import all the files as a stack.</p>
<p>File &gt; Scripts &gt; Load Files into Stack&#8230;</p>
<p>For our ajax loader, expand all the layers next to each other and then save it out to its own gif.  The file size won&#8217;t be that difference in fact.<br />
<div id="attachment_76" class="wp-caption alignnone" style="width: 310px"><a href="http://www.martinilab.com/blog/wp-content/uploads/2009/04/gif-expanded.png"><img src="http://www.martinilab.com/blog/wp-content/uploads/2009/04/gif-expanded-300x29.png" alt="All of the frames set side by side" title="gif-expanded" width="300" height="29" class="size-medium wp-image-76" /></a><p class="wp-caption-text">All of the frames set side by side</p></div></p>
<h2>Now let&#8217;s get back to jQuery</h2>
<p>In our html, just set the div with a width and height to match your gif to prevent clipping and let the script do the rest.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span> src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;js/jquery-1.3.2.min.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span>
$<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>
	<span style="color: #003366; font-weight: bold;">var</span> bgimage <span style="color: #339933;">=</span> <span style="color: #3366CC;">'url(images/ajax-loader-long.gif)'</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> frames <span style="color: #339933;">=</span> <span style="color: #CC0000;">24</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> mpf <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1000</span><span style="color: #339933;">/</span>frames<span style="color: #009900;">&#41;</span>  <span style="color: #006600; font-style: italic;">// how many miliseconds in each frame</span>
	<span style="color: #003366; font-weight: bold;">var</span> currentFrame <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> offset <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.animate'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'background-image'</span><span style="color: #339933;">,</span> bgimage<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">function</span> animate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		offset <span style="color: #339933;">=</span> currentFrame <span style="color: #339933;">*</span> <span style="color: #CC0000;">64</span><span style="color: #339933;">;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.animate'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'background-position'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'-'</span> <span style="color: #339933;">+</span> offset <span style="color: #339933;">+</span> <span style="color: #3366CC;">'px 0px'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		currentFrame <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>currentFrame <span style="color: #339933;">==</span> frames<span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> <span style="color: #CC0000;">1</span> <span style="color: #339933;">:</span> currentFrame <span style="color: #339933;">+</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	setInterval<span style="color: #009900;">&#40;</span>animate<span style="color: #339933;">,</span> mpf<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Now we have a script that will snap the position of the background over each &#8220;frame&#8221; at the correct frame rate. Actually, the frame rate is not divisible by 1000, but it&#8217;s close and it&#8217;s not like you could tell.</p>
<p>The only problem with this script is that it&#8217;s constantly running. If you look at the page in Firebug, your going to see the code whipping around with new values all the time. Annoying! Also, chances are your page isn&#8217;t going to need some animation playing constantly. Ajax loaders are intermittently called when a simple action is called as a&#8230; asynchronous progress indicator! Who knew.</p>
<p>So we&#8217;re going to put in a cancel command to this script: <strong>clearTimeout</strong>.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span> src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;js/jquery-1.3.2.min.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span>
$<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>
	<span style="color: #003366; font-weight: bold;">var</span> bgimage <span style="color: #339933;">=</span> <span style="color: #3366CC;">'url(images/ajax-loader-long.gif)'</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> frames <span style="color: #339933;">=</span> <span style="color: #CC0000;">24</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> mpf <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1000</span><span style="color: #339933;">/</span>frames<span style="color: #009900;">&#41;</span>  <span style="color: #006600; font-style: italic;">// how many miliseconds in each frame</span>
	<span style="color: #003366; font-weight: bold;">var</span> currentFrame <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> offset <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> runAnimate <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.animate'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'background-image'</span><span style="color: #339933;">,</span> bgimage<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">function</span> animate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		offset <span style="color: #339933;">=</span> currentFrame <span style="color: #339933;">*</span> <span style="color: #CC0000;">64</span><span style="color: #339933;">;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.animate'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'background-position'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'-'</span> <span style="color: #339933;">+</span> offset <span style="color: #339933;">+</span> <span style="color: #3366CC;">'px 0px'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		currentFrame <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>currentFrame <span style="color: #339933;">==</span> frames<span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> <span style="color: #CC0000;">1</span> <span style="color: #339933;">:</span> currentFrame <span style="color: #339933;">+</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	runAnimate <span style="color: #339933;">=</span> setInterval<span style="color: #009900;">&#40;</span>animate<span style="color: #339933;">,</span> mpf<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.animate'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toggle</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>
			clearTimeout<span style="color: #009900;">&#40;</span>runAnimate<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</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>
			runAnimate <span style="color: #339933;">=</span> setInterval<span style="color: #009900;">&#40;</span>animate<span style="color: #339933;">,</span> mpf<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Add in a toggle so show how to turn on and off the animation and were done.</p>
<p>It even works on ie6!</p>
<p>Take a look!  <a href="http://www.martinilab.com/blog/pages/animatedgif/animatedgif.html">example</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinilab.com/blog/75/tackling-safaris-slow-gif-feature-with-jquery/feed/</wfw:commentRss>
		</item>
		<item>
		<title>jQuery missing layerX</title>
		<link>http://www.martinilab.com/blog/68/jquery-missing-layerx/</link>
		<comments>http://www.martinilab.com/blog/68/jquery-missing-layerx/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 18:41:46 +0000</pubDate>
		<dc:creator>Chris Williams</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[event]]></category>

		<category><![CDATA[jQuery]]></category>

		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.martinilab.com/blog/?p=68</guid>
		<description><![CDATA[Getting the Mouse position in jQuery is very simple.  However, getting the position from within an element take some extra steps.
Normally, a javascript event such as onmousemove would use event.layerX and event.layerY to get the coordinates of our mouse when it moves.
For jQuery, pageX and pageY will return values from the top left of [...]]]></description>
			<content:encoded><![CDATA[<p>Getting the Mouse position in jQuery is very simple.  However, getting the position from within an element take some extra steps.</p>
<p>Normally, a javascript event such as <strong>onmousemove</strong> would use <strong>event.layerX</strong> and <strong>event.layerY</strong> to get the coordinates of our mouse when it moves.</p>
<p>For jQuery, <strong>pageX</strong> and <strong>pageY</strong> will return values from the top left of the page and not the layer.  Unless the element you&#8217;re working with is left-aligned, you need to calculate the offset of that element as well.  Not only that (unless there is a better way to do this) the offset values returned doesn&#8217;t include the offset values of the parent tag.</p>
<p>In this example, I have two divs.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;frame&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;content&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></td></tr></table></div>

<p>And you can imagine that <em>#frame</em> is centered and has padding. Getting <em>#content&#8217;s</em> offset won&#8217;t include anything outside of the frame so <strong>$(#content).offset().left;</strong> would only get you the distance of itself and its parent.</p>
<h2>Get your layerX for jQuery</h2>
<p>For this example, we are using a known set of divs so we can just write out each div in this script.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;js/jquery-1.3.2.min.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span>
$<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>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#canvasForeground'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">mousemove</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> myLayerX <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#content'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">offset</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">left</span> <span style="color: #339933;">+</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#frame'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">offset</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">left</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> myLayerY <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#content'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">offset</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">top</span> <span style="color: #339933;">+</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#frame'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">offset</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">top</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> x <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> y <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
		x <span style="color: #339933;">=</span> e.<span style="color: #660066;">pageX</span> <span style="color: #339933;">-</span> myLayerX<span style="color: #339933;">;</span>
		y <span style="color: #339933;">=</span> e.<span style="color: #660066;">pageY</span> <span style="color: #339933;">-</span> myLayerY<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>The variables are declared inside the event function to handle window resizing.  Now were this a more complicated page and the element in question has deeply nested or even dynamically generated, writing our all the parent tags wouldn&#8217;t necessarily work (or be very efficient).* But the approach would remain the same.  That&#8217;s it!</p>
<p>*<em>standard apology for poor code writing skills</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinilab.com/blog/68/jquery-missing-layerx/feed/</wfw:commentRss>
		</item>
		<item>
		<title>jQuery Triptych Slideshow</title>
		<link>http://www.martinilab.com/blog/54/jquery-triptych-slide-show/</link>
		<comments>http://www.martinilab.com/blog/54/jquery-triptych-slide-show/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 23:58:04 +0000</pubDate>
		<dc:creator>Chris Williams</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Design]]></category>

		<category><![CDATA[Apple]]></category>

		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.martinilab.com/blog/?p=54</guid>
		<description><![CDATA[My previous how-to showed a new way to look at the slider function featured at the Apple.com/mac site. This one goes to Apple once again and their bucket ads shown in the iTunes Music Store (screen shot). The buckets are what I&#8217;m calling them. They are the three spots at the top of the music [...]]]></description>
			<content:encoded><![CDATA[<p>My previous how-to showed a new way to look at the slider function featured at the Apple.com/mac site. This one goes to Apple once again and their bucket ads shown in the iTunes Music Store (<a href="http://www.martinilab.com/blog/wp-content/uploads/2009/04/itunesplus20090311.jpg" title="screen shot from their site">screen shot</a>). The buckets are what I&#8217;m calling them. They are the three spots at the top of the music store which rotate graphics like the slideshow functions of many galleries. The difference is that these three take turns.</p>
<p>I was able to replicate this function using Scriptaculous on our beloved <a href="http://www.zeuscomics.com">comic shop</a> website (<a href="http://www.martinilab.com/blog/wp-content/uploads/2009/04/zeuscomics-20090401.jpg">latest screen shot</a>). But after a few years of constantly adding duct tape to the site, it was time to move everything to a single framework. And that mean making this triptych banner script run on jQuery.  Hopefully without a lot of html recoding.<br />
<span id="more-54"></span></p>
<h2>Make your list</h2>
<p>For the html, set your divs with a &#8217;slide&#8217; class and a position class.  I guess you can do this in an unordered list, but whatever.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;slide pos1&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;link1&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;slide pos2&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;link2&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;slide pos3&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;link3&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;slide pos1&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;link4&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;slide pos2&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;link5&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;slide pos3&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;link6&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></td></tr></table></div>

<h2>Set your positions</h2>
<p>The easiest solution is to make the position classes absolute.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">&lt;style<span style="color: #00AA00;">&gt;</span>
<span style="color: #6666ff;">.pos1</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.pos2</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">210px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.pos3</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">420px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&lt;/style<span style="color: #00AA00;">&gt;</span></pre></td></tr></table></div>

<h2>Good news, everyone! This script doesn&#8217;t need a plug-in.</h2>
<p>I always start my script codes with an apology, so why stop now.  I&#8217;m sorry.</p>
<p>The first part makes sure that the banners appear in the order that their written in html.  Because of the absolute positioning, however, they stack on top of each other and the last will be on top.</p>
<p>Also, I didn&#8217;t like how <em>i</em> in jQuery&#8217;s <em>each</em> function started at 1 and not 0, but that&#8217;s just me.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;js/jquery-1.3.2.min.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span>
$<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>
    <span style="color: #003366; font-weight: bold;">var</span> slideCount <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.slide'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.slide'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</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: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'z-index'</span><span style="color: #339933;">,</span> slideCount <span style="color: #339933;">-</span> i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">var</span> currentSlide <span style="color: #339933;">=</span> slideCount<span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> zIndex <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">function</span> imgRotate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.slide'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</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: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'z-index'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> currentSlide<span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</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: #660066;">fadeOut</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'slow'</span><span style="color: #339933;">,</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>
                    $<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;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'z-index'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000066; font-weight: bold;">else</span>
            <span style="color: #009900;">&#123;</span>
                zIndex <span style="color: #339933;">=</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: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'z-index'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                zIndex <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>zIndex<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> parseInt<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'z-index'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span>zIndex<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    setInterval<span style="color: #009900;">&#40;</span>imgRotate<span style="color: #339933;">,</span> <span style="color: #CC0000;">4000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>This script should be able to make with any number of banners and any number of sets.  This example just used a set of three, but your can make it a set of two, or four, or ten!  Just make the list divisible by the set and fix your positions of course.</p>
<h2>Putting it all together</h2>
<p>See in action here <a href="http://www.martinilab.com/blog/pages/slideshow/index.html">Demo</a></p>
<p>Hopefully, I&#8217;ll get this to the Zeus Comics site very soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinilab.com/blog/54/jquery-triptych-slide-show/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
