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

<channel>
	<title>ENHANCE</title>
	<atom:link href="http://enhance.qd-creative.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://enhance.qd-creative.co.uk</link>
	<description>Enhancing everyone's experience of the web!</description>
	<pubDate>Sat, 06 Dec 2008 16:51:46 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<item>
		<title>The magic of &#8216;onload&#8217;, revealed!</title>
		<link>http://enhance.qd-creative.co.uk/2008/12/06/the-magic-of-onload-revealed/</link>
		<comments>http://enhance.qd-creative.co.uk/2008/12/06/the-magic-of-onload-revealed/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 15:37:22 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://enhance.qd-creative.co.uk/?p=119</guid>
		<description><![CDATA[In JavaScript the onload event is triggered when a page or element has finished loading. We&#8217;re advised not to use it when firing off web applications or small enhancements because most of the time these things don&#8217;t require the page to have fully loaded, they just require the DOM to be ready. 

Assigning a function [...]]]></description>
			<content:encoded><![CDATA[<p>In JavaScript the <a href="http://www.w3schools.com/jsref/jsref_onload.asp">onload</a> event is triggered when a page or element has finished loading. We&#8217;re advised not to use it when firing off web applications or small enhancements because most of the time these things don&#8217;t require the page to have fully loaded, they just require the DOM to be ready. </p>
<span id="more-119"></span>
<p>Assigning a function to the onload event in jQuery is done like this:</p>


<div class="wp_syntax"><div class="code"><pre class="javascript">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'img#hello'</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">load</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: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Image is loaded'</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></pre></div></div>



<p>Recently, I created a new template for Theme Forest (&#8217;<a href="http://themeforest.net/item/pixelle/22363">Pixelle</a>&#8216;) which features an integrated gallery. To make the user experience as seamless as possible it made sense to load all the images before the user could start browsing the gallery - the user is presented with an animated loading gif and a feedback box which updates every 300 milliseconds (showing how many images have loaded so far). </p>
<p>To make this work I could have just used the onload event of the window object (the infamous <code>window.onload</code>). The only problem is that doing so would mean that the user wouldn&#8217;t just have to wait for the gallery images to load, but all images, external scripts, &#8216;StyleSheets&#8217; and &#8216;iframes&#8217; (if there were any) would have to load before the <code>window.onload</code> event is fired. Additionally, if we used <code>window.onload</code>, the user would not recieve any feedback!</p>
<p>The only way to provide the user with accurate progress feedback would be to use the <code>onload</code> event of each individual image. What I ended up doing is adding a new property to each image when it&#8217;s loaded. I used jQuery&#8217;s &#8216;data&#8217; function:</p>


<div class="wp_syntax"><div class="code"><pre class="javascript">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ul.gallery img'</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">load</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: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">data</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'isLoaded'</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">true</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></pre></div></div>



<p>While the data function may seem a mysterious and magical thing all it essentially does is add a new property (property !== attribute) to an element. (With jQuery it&#8217;s a little more involved because a cache is used to store referenced properties).</p>
<p>Anyway, this &#8216;isLoaded&#8217; property idea allowed me to check the progress at pre-defined intervals of 300 millseconds:</p>


<div class="wp_syntax"><div class="code"><pre class="javascript"><span style="color: #003366; font-weight: bold;">function</span> check<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Amount of loaded images:</span>
    <span style="color: #003366; font-weight: bold;">var</span> loaded <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>
        total <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ul.gallery img'</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">length</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Loop through all relevant images:</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ul.gallery img'</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">each</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>
&nbsp;
        <span style="color: #006600; font-style: italic;">// If this images has loaded:</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: #006600;">data</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'isLoaded'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
            <span style="color: #006600; font-style: italic;">// Increment value of 'loaded':</span>
            loaded<span style="color: #339933;">++;</span>
&nbsp;
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// If the amount of loaded images is the</span>
    <span style="color: #006600; font-style: italic;">// same as the total amount of images:</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>loaded<span style="color: #339933;">===</span>total<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// e.g. alert message:</span>
        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'All gallery images have loaded!'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// Update the feedback box: (e.g. &quot;1 out of 20 images have been loaded&quot;)</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#feedback'</span><span style="color: #009900;">&#41;</span>
        	.<span style="color: #006600;">html</span><span style="color: #009900;">&#40;</span>loaded <span style="color: #339933;">+</span> <span style="color: #3366CC;">' out of '</span> <span style="color: #339933;">+</span> total <span style="color: #339933;">+</span> <span style="color: #3366CC;">' images have been loaded'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// Check again in 300 milliseconds:</span>
        setTimeout<span style="color: #009900;">&#40;</span>check<span style="color: #339933;">,</span><span style="color: #CC0000;">300</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// Run function:</span>
check<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>



<p>Obviously this logic could be used in a number of applications, not just a photo gallery.</p>
<p>I&#8217;m not sure how useful others will find it but I created a <strong>jQuery plugin</strong> with a similar purpose, except it does not have a feedback feature:</p>


<div class="wp_syntax"><div class="code"><pre class="javascript"><span style="color: #006600; font-style: italic;">// 'whenLoaded' jQuery plugin, simple and short:</span>
&nbsp;
<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: #006600;">fn</span>.<span style="color: #006600;">whenLoaded</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>fn<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #003366; font-weight: bold;">var</span> $elements <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span>
            total <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">length</span><span style="color: #339933;">;</span>
&nbsp;
        $elements.<span style="color: #006600;">each</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: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">load</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: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">data</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'isLoaded'</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">true</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: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #003366; font-weight: bold;">function</span> check<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> loaded <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
            $elements.<span style="color: #006600;">each</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: #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: #006600;">data</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'isLoaded'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    loaded<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: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>loaded<span style="color: #339933;">===</span>total<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                fn.<span style="color: #006600;">call</span><span style="color: #009900;">&#40;</span>$elements<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>
                setTimeout<span style="color: #009900;">&#40;</span>check<span style="color: #339933;">,</span><span style="color: #CC0000;">300</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        check<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;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>



<p>(&#8217;whenLoaded&#8217; jQuery plugin download: <a href="http://qd9.co.uk/me/demos/whenloaded/jquery.whenloaded.js">jquery.whenloaded.js</a>)</p>
<p>The point in it is to simplify the process of attaching one onload event to multiple objects so that when all objects have loaded the single event fires (figuratively speaking). It&#8217;s easier if I just show you an example:</p>
<h3>Fading in all images within a page</h3>
<p>Let&#8217;s say that you want to fade in all the images within your document when they&#8217;ve loaded:</p>


<div class="wp_syntax"><div class="code"><pre class="javascript">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'img'</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    opacity<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">load</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: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>opacity<span style="color: #339933;">:</span><span style="color: #CC0000;">1</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></pre></div></div>



<p>The only problem with the above code is that it will fade each image in after each particular image has loaded. This may be what you&#8217;re after, in which case, good for you, if however you are looking to fire a function when ALL images have finished loading then the &#8216;whenLoaded&#8217; plugin may be useful to you! An example:


<div class="wp_syntax"><div class="code"><pre class="javascript">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'img'</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    opacity<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">whenLoaded</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: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>opacity<span style="color: #339933;">:</span><span style="color: #CC0000;">1</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></pre></div></div>



<p>Now, nothing will happen until all images are finished loading at which point <strong>they will all fade in at the same time</strong>. Note: the <code>'this'</code> keyword within the callback function references all the selected elements, not just one.</p>
<p>If you&#8217;re wondering  what the difference is between using <code>$(window).load()</code> and <code>$('img').whenLoaded()</code> the former will wait until all assets have loaded (including iframes, external scripts and CSS StyleSheets while the latter will run when all images have loaded.</p>
<p>You may not want to target all images in which case you can use jQuery&#8217;s selector engine as per usual:</p>


<div class="wp_syntax"><div class="code"><pre class="javascript">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ul.sidebar #widget-x img.tiny'</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    opacity<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">whenLoaded</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: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'All tiny images within '</span>widget<span style="color: #339933;">-</span>x<span style="color: #3366CC;">' have been loaded!'</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: #006600;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>opacity<span style="color: #339933;">:</span><span style="color: #CC0000;">1</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></pre></div></div>



<p>The reason we&#8217;re setting the images to <code>opacity:0;</code> as opposed to <code>display:none;</code> is so that the space they accomodate is retained even when they&#8217;re not visible. This will only work properly if you have set the <code>width</code> and <code>height</code> attributes of each image.</p>
<h3>An even cooler example</h3>
<p><strong>Problem</strong>: We have a bunch of thumbnails on a single page - the client has requested that all thumbnails fade in one after the other. For this to work all thumbnails must already be loaded before the cascading effect begins.</p>
<p>The <code>window.onload</code> / <code>body.onload</code> events are out of the question because there is a massive background image (1.7mb!) meaning that those events won&#8217;t be fired until that huge image has loaded. Somehow we need to collectively target the onload event of all the thumbnail images without having to wait for the huge background image to load.</p>
<p><strong>Solution</strong>: We&#8217;ll use the &#8216;whenLoaded&#8217; plugin! <img src='http://enhance.qd-creative.co.uk/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>


<div class="wp_syntax"><div class="code"><pre class="javascript">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'div#thumbnails img'</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Prepare image for awesome effect:</span>
    opacity<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>
    height<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>
    width<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">whenLoaded</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>
&nbsp;
    <span style="color: #006600; font-style: italic;">// When ALL images are loaded  go through</span>
    <span style="color: #006600; font-style: italic;">// all and apply effect (lasting 400ms) to </span>
    <span style="color: #006600; font-style: italic;">// each image with an interval of 200ms:</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">var</span> all <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: #339933;">;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">function</span> fadeIn<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: #339933;">!</span>all<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
        $<span style="color: #009900;">&#40;</span>all<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
            opacity<span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span>
            height<span style="color: #339933;">:</span> <span style="color: #3366CC;">'48px'</span><span style="color: #339933;">,</span>
            width<span style="color: #339933;">:</span> <span style="color: #3366CC;">'48px'</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #CC0000;">400</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        setTimeout<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>
            fadeIn<span style="color: #009900;">&#40;</span>i<span style="color: #CC0000;">+1</span><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: #CC0000;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    fadeIn<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</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></pre></div></div>



<p><strong style="font-size:1.3em"><a href="http://qd9.co.uk/me/demos/whenloaded/jQuery-cascading-thumbs.html">You can see a demo of the solved problem over here!</a></strong></p>
<h3>The sky&#8217;s the limit!</h3>
<p>Just like the onload event itself this plugin will support iframes, script/link elements, framesets, images etc. Another useful application of this plugin would be to wait for all your StyleSheets to load (e.g. <code>$('link[rel=stylesheet]').whenLoaded()</code> )- why would you want to do this? Well, if you have a web application which requires external CSS styles then it might be a good idea to only fire it off when you know for sure that those stylesheets have loaded!</p>]]></content:encoded>
			<wfw:commentRss>http://enhance.qd-creative.co.uk/2008/12/06/the-magic-of-onload-revealed/feed/</wfw:commentRss>
		</item>
		<item>
		<title>10 Useful Wordpress Plugins</title>
		<link>http://enhance.qd-creative.co.uk/2008/11/20/10-useful-wordpress-plugins/</link>
		<comments>http://enhance.qd-creative.co.uk/2008/11/20/10-useful-wordpress-plugins/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 20:55:59 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[General]]></category>

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

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

		<guid isPermaLink="false">http://enhance.qd-creative.co.uk/?p=114</guid>
		<description><![CDATA[There are an amazing amount of Wordpress plugins to choose from (over 3000!), some of them are great, some of them leave a lot to be desired. Here&#8217;s a list of 10 wordpress plugins that have proved their worth and are definitely worth a look! 


	
		
		WP Super Cache
		Super Cache is a true life-saver, especially if [...]]]></description>
			<content:encoded><![CDATA[<p>There are an amazing amount of <a href="http://wordpress.org/extend/plugins/">Wordpress plugins</a> to choose from (over 3000!), some of them are great, some of them leave a lot to be desired. Here&#8217;s a list of 10 wordpress plugins that have proved their worth and are definitely worth a look! </p>
<span id="more-114"></span>
<ul class="imglist">
	<li>
		<div class="content-image-left"><a href="http://wordpress.org/extend/plugins/wp-super-cache/"><img alt="WP super cache" src="http://enhance.qd-creative.co.uk/images/posts/2008/10wordpress/super.jpg"/></a></div>
		<h3><a href="http://wordpress.org/extend/plugins/wp-super-cache/">WP Super Cache</a></h3>
		<p>Super Cache is a true life-saver, especially if you&#8217;re likely to get Dugg or Stumbled quite a lot!</p>
		<blockquote><p>This plugin generates static html files from your dynamic WordPress blog. After a html file is generated your webserver will serve that file instead of processing the comparatively heavier and more expensive WordPress PHP scripts.</p>
		</blockquote>
		<p><a href="http://wordpress.org/extend/plugins/wp-super-cache/">Go to the &#8216;WP-Super-Cache&#8217; plugin page &raquo;</a></p>
	</li>
    <li>
		<div class="content-image-left"><a href="http://urbangiraffe.com/plugins/headspace2/"><img alt="Headspace 2" src="http://enhance.qd-creative.co.uk/images/posts/2008/10wordpress/headspace.jpg"/></a></div>
		<h3><a href="http://urbangiraffe.com/plugins/headspace2/">HeadSpace 2</a></h3>
		<p>HeadSpace 2 is wonderful, it allows you to modify every tiny bit of SEO related info on pages, posts, categories etc.</p>
		<blockquote><p>HeadSpace is a powerful all-in-one plugin to manage meta-data and handle a wide range of SEO tasks. With it you can tag your posts, create custom titles and descriptions that improve your page ranking, change the theme or run disabled plugins on specific pages, and a whole lot more.</p>
		</blockquote>
		<p><a href="http://urbangiraffe.com/plugins/headspace2/">Go to the &#8216;HeadSpace 2&#8242; plugin site &raquo;</a></p>
	</li>
    <li>
		<div class="content-image-left"><a href="http://wordpress.org/extend/plugins/wp-syntax/"><img alt="WP-Syntax" src="http://enhance.qd-creative.co.uk/images/posts/2008/10wordpress/syntax.jpg"/></a></div>
		<h3><a href="http://wordpress.org/extend/plugins/wp-syntax/">WP-Syntax</a></h3>
		<p>This is the BEST way to highlight your code syntax if you&#8217;re using Wordpress. Forget those unreliable and slow <a href="http://code.google.com/p/syntaxhighlighter/">client</a>-<a href="http://shjs.sourceforge.net/">side</a> <a href="http://softwaremaniacs.org/soft/highlight/en/">alternatives</a>, this will do it all behind the scenes!</p>
		<blockquote><p>WP-Syntax provides clean syntax highlighting using GeSHi &#8212; supporting a wide range of popular languages. It supports highlighting with or without line numbers and maintains formatting while copying snippets of code from the browser.</p>
		</blockquote>
		<p><a href="http://wordpress.org/extend/plugins/wp-syntax/">Go to the &#8216;WP-Syntax&#8217; plugin page &raquo;</a></p>
	</li>
    <li>
		<div class="content-image-left"><a href="http://wordpress.org/extend/plugins/live-comment-preview/"><img alt="Live comment preview" src="http://enhance.qd-creative.co.uk/images/posts/2008/10wordpress/live.jpg"/></a></div>
		<h3><a href="http://wordpress.org/extend/plugins/live-comment-preview/">Live Comment Preview</a></h3>
		<p>I&#8217;m quite lazy and haven&#8217;t got round to implementing this one but it looks great!</p>
		<blockquote><p>Live Comment Preview is the simplest way to get live comment previews on your site. Simply activate the plugin &#8212; That&#8217;s it! This plugin uses only client-side Javascript to format a preview, it does not make any Ajax requests to the server. This provides a smooth live preview as you type.</p>
		</blockquote>
		<p><a href="http://wordpress.org/extend/plugins/live-comment-preview/">Go to the &#8216;Live Comment Preview&#8217; plugin page &raquo;</a></p>
	</li>
    <li>
		<div class="content-image-left"><a href="http://wordpress.org/extend/plugins/get-recent-comments/"><img alt="Recent comments" src="http://enhance.qd-creative.co.uk/images/posts/2008/10wordpress/recent.jpg"/></a></div>
		<h3><a href="http://wordpress.org/extend/plugins/get-recent-comments/">Get Recent Comments</a></h3>
		<p>It&#8217;s quite nice to have widgets like this in your sidebar, just to assure your users that your blog is active.</p>
		<blockquote><p>This plugin displays excerpts of the most recent comments and/or trackbacks that have been posted to the articles in your blog.</p>
		</blockquote>
		<p><a href="http://wordpress.org/extend/plugins/get-recent-comments/">Go to the &#8216;Get Recent Comments&#8217; plugin page &raquo;</a></p>
	</li>
    <li>
		<div class="content-image-left"><a href="http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/"><img alt="Related posts" src="http://enhance.qd-creative.co.uk/images/posts/2008/10wordpress/related.jpg"/></a></div>
		<h3><a href="http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/">Related posts</a></h3>
		<p>A handy plugin, especially useful for blogs with vast quantities of similar content.</p>
		<blockquote><p>WordPress Related Posts Plugin will generate a related posts via WordPress tags, and add the related posts to feed.</p>
		</blockquote>
		<p><a href="http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/">Go to the &#8216;Related Posts&#8217; plugin page &raquo;</a></p>
	</li>
    <li>
		<div class="content-image-left"><a href="http://wordpress.org/extend/plugins/cforms/"><img alt="cForms II" src="http://enhance.qd-creative.co.uk/images/posts/2008/10wordpress/cforms.jpg"/></a></div>
		<h3><a href="http://wordpress.org/extend/plugins/cforms/">cformsII Contact Form</a></h3>
		<p>There are quite a few contact form plugins for Wordpress, this one seems to be the best reviewed.</p>
		<blockquote><p>cforms is a highly customizable, flexible and powerful form builder plugin, covering a variety of use cases and features from attachments to multi form management, you can even have multiple forms on the same page!</p>
		</blockquote>
		<p><a href="http://wordpress.org/extend/plugins/cforms/">Go to the &#8216;cformsII&#8217; plugin page &raquo;</a></p>
	</li>
    <li>
		<div class="content-image-left"><a href="http://katesgasis.com/2006/05/02/sideblog-plugin-v30/"><img alt="Sideblog" src="http://enhance.qd-creative.co.uk/images/posts/2008/10wordpress/sideblog.jpg"/></a></div>
		<h3><a href="http://katesgasis.com/2006/05/02/sideblog-plugin-v30/">Sideblog</a></h3>
		<p>Sometimes you just want to update your blog with a little info instead of an entire post - that&#8217;s what this plugin is for!</p>
		<blockquote><p>Sideblog is a plugin for Wordpress Blog Platform. It is one way of
implementing “Asides” - a series of “short” posts, 1-2 sentences in
length. Sideblog is now in version 3.</p>
		</blockquote>
		<p><a href="http://katesgasis.com/2006/05/02/sideblog-plugin-v30/">Go to the &#8216;Sideblog&#8217; plugin site &raquo;</a></p>
	</li>
    <li>
		<div class="content-image-left"><a href="http://mtekk.weblogs.us/code/breadcrumb-navxt/"><img alt="breadcrumb" src="http://enhance.qd-creative.co.uk/images/posts/2008/10wordpress/bread.jpg"/></a></div>
		<h3><a href="http://mtekk.weblogs.us/code/breadcrumb-navxt/">Breadcrumb NavXT</a></h3>
		<p>Breadcrumbs can seem quite an old-fashioned feature but can really enhance the usability of your site, this plugin makes it really easy to add that functionality to your blog.</p>
		<blockquote><p>Breadcrumb NavXT is a WordPress plugin compatible with WordPress versions 2.5 and up. This plugin generates locational breadcrumb trails for your WordPress blog.</p>
		</blockquote>
		<p><a href="http://mtekk.weblogs.us/code/breadcrumb-navxt/">Go to the &#8216;Breadcrumb NavXT&#8217; plugin site &raquo;</a></p>
	</li>
    <li>
		<div class="content-image-left"><a href="http://wordpress.org/extend/plugins/sociable/"><img alt="Sociable" src="http://enhance.qd-creative.co.uk/images/posts/2008/10wordpress/sociable.jpg"/></a></div>
		<h3><a href="http://wordpress.org/extend/plugins/sociable/">Sociable</a></h3>
		<p>Sociable appends a list of the social bookmarking sites (ie. Digg, Del.icio.us, Reddit) at the end of your posts. Very useful!</p>
		<blockquote><p>Social bookmarking sites allow websurfers to save, catalog, and share interesting pages they find online. The Sociable plugin appends links for your readers to use those sites to the end of each of your blog’s posts, increasing your potential audience. </p>
		</blockquote>
		<p><a href="http://wordpress.org/extend/plugins/sociable/">Go to the &#8216;Sociable&#8217; plugin page &raquo;</a></p>
	</li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://enhance.qd-creative.co.uk/2008/11/20/10-useful-wordpress-plugins/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New jQuery plugin: Pulse</title>
		<link>http://enhance.qd-creative.co.uk/2008/11/05/new-jquery-plugin-pulse/</link>
		<comments>http://enhance.qd-creative.co.uk/2008/11/05/new-jquery-plugin-pulse/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 15:30:19 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

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

		<guid isPermaLink="false">http://enhance.qd-creative.co.uk/?p=108</guid>
		<description><![CDATA[This is a brand new plugin which applies a continual pulse to any element specified. &#8216;Pulseable&#8217;  properties include &#34;background-color&#8217;, &#8216;color&#8221; &#8216;border-color&#8217; and  &#8216;opacity&#8217;. Specifying more than one property to pulse on a single element can have a pretty cool effect.
Visit the plugin page &#187;

A quick example of what it can do:
Initiate pulsing





Even though [...]]]></description>
			<content:encoded><![CDATA[<p>This is a brand new plugin which applies a continual pulse to any element specified. &#8216;Pulseable&#8217;  properties include &quot;background-color&#8217;, &#8216;color&#8221; &#8216;border-color&#8217; and  &#8216;opacity&#8217;. Specifying more than one property to pulse on a single element can have a pretty cool effect.</p>
<h4><a href="http://enhance.qd-creative.co.uk/demos/pulse">Visit the plugin page </a>&raquo;</h4>
<span id="more-108"></span>
<p>A quick example of what it can do:</p>
<button id="init-photo-demo">Initiate pulsing</button>
<img id="png-photo" src="http://enhance.qd-creative.co.uk/demos/pulse/png-photo.png" alt="sign on road" style="margin:10px 0;display:block;" />
<script type="text/javascript" src="http://enhance.qd-creative.co.uk/demos/pulse/pulse.jquery.js"></script>
<script type="text/javascript">
<!--
$('#init-photo-demo').toggle(function(){
	$(this).html('stop pulsing');
	$('#png-photo').pulse({
		backgroundColors: ['#eeae00','#ffdf5e'],
		speed: 500
	});
},function(){$(this).html('Initiate pulsing');$('img',$(this).parent()).recover();});
-->
</script>
<p>Even though the <a href="http://enhance.qd-creative.co.uk/demos/pulse">demonstations</a> are quite playful this plugin could potentially be used for some very practical causes. </p>]]></content:encoded>
			<wfw:commentRss>http://enhance.qd-creative.co.uk/2008/11/05/new-jquery-plugin-pulse/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to make a navigable &#038; horizontally scrollable portfolio</title>
		<link>http://enhance.qd-creative.co.uk/2008/10/26/how-to-make-a-navigable-horizontally-scrollable-portfolio/</link>
		<comments>http://enhance.qd-creative.co.uk/2008/10/26/how-to-make-a-navigable-horizontally-scrollable-portfolio/#comments</comments>
		<pubDate>Sun, 26 Oct 2008 19:11:57 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://enhance.qd-creative.co.uk/?p=99</guid>
		<description><![CDATA[In this short tutorial I&#8217;ll be demonstrating how easy it is to create your own horizontal scrolling portfolio. Obviously you can use this effect for things other than a portfolio; you could use it for a short photo gallery, slideshow or a product showcase&#8230;
Have a look at the demo to see what I&#8217;m talking about.

Download [...]]]></description>
			<content:encoded><![CDATA[<p>In this short tutorial I&#8217;ll be demonstrating how easy it is to create your own horizontal scrolling portfolio. Obviously you can use this effect for things other than a portfolio; you could use it for a short photo gallery, slideshow or a product showcase&#8230;</p>
<h4><a href="http://qd9.co.uk/me/demos/portfolio1/">Have a look at the demo</a> to see what I&#8217;m talking about.</h4>
<span id="more-99"></span>
<h4><a href="http://qd9.co.uk/me/demos/hz-jquery-portfolio.zip">Download the demo ZIP</a></h4>
<p>I&#8217;ll be using <a href="http://jquery.com">jQuery</a> for this tutorial. We won&#8217;t need any plugins. Right let&#8217;s start!</p>
<p>We&#8217;ll start with a basic <code>XHTML</code> document with jQuery, our StyleSheet and our JS file linked to:</p>


<div class="wp_syntax"><div class="code"><pre class="html4strict"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span>?xml <span style="color: #000066;">version</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;1.0&quot;</span> encoding<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;UTF-8&quot;</span>?<span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;html</span> xmlns<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span> xml:<span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;en&quot;</span> <span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;en&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;head&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;meta</span> <span style="color: #000066;">http-equiv</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Content-Type&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/html; charset=utf-8&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title&gt;</span></span>Portfolio - Horizontal Scrolling<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;portfolio.js&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;portfolio.css&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/head&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;body&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;container&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
		<span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- Stuff goes here --&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/body&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/html&gt;</span></span></pre></div></div>



<p>The next step is to markup the portfolio. I&#8217;ll be using an unordered list with each of the portfolio pieces as a list item:</p>


<div class="wp_syntax"><div class="code"><pre class="html4strict"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h1&gt;</span></span>Portfolio<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h1&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ul</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;portfolio&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;piece1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;img/1.png&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;portfolio piece 1 preview&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h2&gt;</span></span>Portfolio piece 1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h2&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></span>Lorem ipsum dolor...<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>More details <span style="color: #ddbb00;">&amp;raquo;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;piece2&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;img/2.png&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;portfolio piece 2 preview&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h2&gt;</span></span>Portfolio piece 2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h2&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></span>Lorem ipsum dolor...<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>More details <span style="color: #ddbb00;">&amp;raquo;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;piece3&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;img/3.png&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;portfolio piece 3 preview&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h2&gt;</span></span>Portfolio piece 3<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h2&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></span>Lorem ipsum dolor...<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>More details <span style="color: #ddbb00;">&amp;raquo;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;piece4&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;img/4.png&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;portfolio piece 4 preview&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h2&gt;</span></span>Portfolio piece 4<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h2&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></span>Lorem ipsum dolor...<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>More details <span style="color: #ddbb00;">&amp;raquo;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;piece5&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;img/5.png&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;portfolio piece 5 preview&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h2&gt;</span></span>Portfolio piece 5<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h2&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></span>Lorem ipsum dolor...<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>More details <span style="color: #ddbb00;">&amp;raquo;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;piece6&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;img/6.png&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;portfolio piece 6 preview&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h2&gt;</span></span>Portfolio piece 6<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h2&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></span>Lorem ipsum dolor...<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>More details <span style="color: #ddbb00;">&amp;raquo;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;piece7&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;img/7.png&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;portfolio piece 7 preview&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h2&gt;</span></span>Portfolio piece 7<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h2&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></span>Lorem ipsum dolor...<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>More details <span style="color: #ddbb00;">&amp;raquo;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;piece8&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;img/8.png&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;portfolio piece 8 preview&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h2&gt;</span></span>Portfolio piece 8<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h2&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></span>Lorem ipsum dolor...<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>More details <span style="color: #ddbb00;">&amp;raquo;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;piece9&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;img/9.png&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;portfolio piece 9 preview&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h2&gt;</span></span>Portfolio piece 9<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h2&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></span>Lorem ipsum dolor...<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>More details <span style="color: #ddbb00;">&amp;raquo;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;piece10&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;img/10.png&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;portfolio piece 10 preview&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h2&gt;</span></span>Portfolio piece 10<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h2&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></span>Lorem ipsum dolor...<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>More details <span style="color: #ddbb00;">&amp;raquo;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ul&gt;</span></span></pre></div></div>



<p>We&#8217;ll also need to add some basic styles: (<code>portfolio.css</code>)</p>


<div class="wp_syntax"><div class="code"><pre class="css">body,ul,li,h1,h2,p,img <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #66cc66;">:</span> <span style="color: #933;">0</span><span style="color: #66cc66;">;</span>
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #66cc66;">:</span> <span style="color: #933;">0</span><span style="color: #66cc66;">;</span>
    <span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #66cc66;">:</span> <span style="color: #993333;">none</span><span style="color: #66cc66;">;</span>
    <span style="color: #000000; font-weight: bold;">border</span><span style="color: #66cc66;">:</span> <span style="color: #993333;">none</span><span style="color: #66cc66;">;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#container</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #66cc66;">:</span> <span style="color: #933;">900px</span><span style="color: #66cc66;">;</span>
    <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #66cc66;">:</span> <span style="color: #933;">0</span> <span style="color: #993333;">auto</span><span style="color: #66cc66;">;</span>
    <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #66cc66;">:</span> <span style="color: #933;">0</span><span style="color: #6666ff;"><span style="color: #933;">.8em</span></span><span style="color: #66cc66;">;</span>
    <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #66cc66;">:</span> Arial, <span style="color: #993333;">sans-serif</span><span style="color: #66cc66;">;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
h1 <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #66cc66;">:</span> <span style="color: #933;">2</span><span style="color: #6666ff;"><span style="color: #933;">.4em</span></span><span style="color: #66cc66;">;</span>
    <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #66cc66;">:</span> <span style="color: #993333;">center</span><span style="color: #66cc66;">;</span>
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #66cc66;">:</span> <span style="color: #933;">30px</span> <span style="color: #933;">0</span><span style="color: #66cc66;">;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
h2 <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #66cc66;">:</span> <span style="color: #933;">1</span><span style="color: #6666ff;"><span style="color: #933;">.3em</span></span><span style="color: #66cc66;">;</span>
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #66cc66;">:</span> <span style="color: #933;">0</span><span style="color: #6666ff;"><span style="color: #933;">.5em</span></span> <span style="color: #933;">0</span><span style="color: #66cc66;">;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#portfolio</span> li <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #66cc66;">:</span> <span style="color: #993333;">hidden</span><span style="color: #66cc66;">;</span>
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #66cc66;">:</span> <span style="color: #933;">10px</span><span style="color: #66cc66;">;</span>
    <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #66cc66;">:</span> <span style="color: #933;">10px</span> <span style="color: #933;">0</span><span style="color: #66cc66;">;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#portfolio</span> li img <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">float</span><span style="color: #66cc66;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #66cc66;">;</span>
    <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #66cc66;">:</span> <span style="color: #933;">0</span> <span style="color: #933;">10px</span> <span style="color: #933;">0</span> <span style="color: #933;">0</span><span style="color: #66cc66;">;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#portfolio</span> li p <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #66cc66;">:</span> <span style="color: #933;">0</span><span style="color: #6666ff;"><span style="color: #933;">.3em</span></span> <span style="color: #933;">0</span> <span style="color: #933;">0</span><span style="color: #6666ff;"><span style="color: #933;">.5em</span></span> <span style="color: #933;">0</span><span style="color: #66cc66;">;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>



<p>You&#8217;ll notice that each portfolio item has an <code>H2</code> which contains the title, an <code>IMG</code> (which has a preview of the portfolio piece) and a paragraph explaining the portfolio piece. The next step is to extract the required information using jQuery and generate a navigation menu which will allow users to navigate through each slide of the portfolio.</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
35
36
37
38
39
40
41
42
43
44
45
46
47
</pre></td><td class="code"><pre class="javascript"><span style="color: #006600; font-style: italic;">// portfolio.js</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: #006600; font-style: italic;">// Function initiates when DOM is ready</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Apply styles to #portfolio and wrap it in #portfolio-wrapper</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#portfolio'</span><span style="color: #009900;">&#41;</span>
        .<span style="color: #006600;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
            height<span style="color: #339933;">:</span> <span style="color: #3366CC;">'163px'</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// 163 is the height of each portfolio piece </span>
            width<span style="color: #339933;">:</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: #006600;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#portfolio li'</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'px'</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// i.e. 900x10 = 9000</span>
            position<span style="color: #339933;">:</span> <span style="color: #3366CC;">'relative'</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
        .<span style="color: #006600;">wrap</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;div id=&quot;portfolio-wrapper&quot; style=&quot;width:900px;overflow:hidden;position:relative;&quot;&gt;&lt;/div&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Wrap in new DIV element (required for scroll to work properly)</span>
&nbsp;
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#portfolio li'</span><span style="color: #009900;">&#41;</span>
        <span style="color: #006600; font-style: italic;">// Looping through each list-item:</span>
        .<span style="color: #006600;">each</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>
&nbsp;
            <span style="color: #003366; font-weight: bold;">var</span> newNavItem <span style="color: #339933;">=</span> addPortfolioNavItem<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: #006600;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'id'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'img:eq(0)'</span><span style="color: #339933;">,</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'src'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'h2'</span><span style="color: #339933;">,</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">text</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            newNavItem.<span style="color: #006600;">children</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a:eq(0)'</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">click</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: #006600; font-style: italic;">// When portfolio nav-item is clicked:</span>
                $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'img'</span><span style="color: #339933;">,</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>opacity<span style="color: #339933;">:</span><span style="color: #CC0000;">0.8</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Dim to .8 opacity (to show the user they've been there)</span>
                <span style="color: #003366; font-weight: bold;">var</span> id <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: #006600;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'href'</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// FIX: IE returns actual HREF instead of href attribute</span>
                <span style="color: #003366; font-weight: bold;">var</span> difference <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#portfolio'</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">offset</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">left</span><span style="color: #339933;">-</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#portfolio li#'</span> <span style="color: #339933;">+</span> id<span style="color: #009900;">&#41;</span>.<span style="color: #006600;">offset</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">left</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// leftOffset of ul#portfolio minus leftOffset of selected portfolio piece</span>
                $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#portfolio'</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>left<span style="color: #339933;">:</span> difference<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">700</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Animate to the value of different over 700 milliseconds</span>
                <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// prevent default action of links</span>
            <span style="color: #009900;">&#125;</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: #006600;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
            width<span style="color: #339933;">:</span> <span style="color: #3366CC;">'880px'</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// Specify width as 880 (900 minus 10px padding on each side)</span>
            margin<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> 
            float<span style="color: #339933;">:</span> <span style="color: #3366CC;">'left'</span>
        <span style="color: #009900;">&#125;</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>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> addPortfolioNavItem<span style="color: #009900;">&#40;</span>id<span style="color: #339933;">,</span>imgSrc<span style="color: #339933;">,</span>title<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// If the new navigation menu has NOT been created yet:</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#portfolio-nav'</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">get</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: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">// Test whether nav-menu already exists</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;ul id=&quot;portfolio-nav&quot;/&gt;'</span><span style="color: #009900;">&#41;</span>
            .<span style="color: #006600;">insertBefore</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#portfolio-wrapper'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// If it does not exist then create it and insert before #portfolio-wrapper (an element which will be created later)</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #006600; font-style: italic;">// creates a new list item and appends it to #portfolio-nav</span>
    <span style="color: #000066; font-weight: bold;">return</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;li&gt;&lt;a href=&quot;#'</span> <span style="color: #339933;">+</span> id <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot; title=&quot;'</span> <span style="color: #339933;">+</span> title <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot;&gt;&lt;img width=&quot;90&quot; src=&quot;'</span> <span style="color: #339933;">+</span> imgSrc <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot; alt=&quot;'</span> <span style="color: #339933;">+</span> title <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot; /&gt;&lt;/a&gt;&lt;/li&gt;'</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>display<span style="color: #339933;">:</span><span style="color: #3366CC;">'inline'</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006600;">appendTo</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#portfolio-nav'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>



<p>You&#8217;ll see that we&#8217;re looping through each list item of the portfolio and then calling the <code>addPortfolioNavItem</code> function which will create a new navigation item and append it to the newly created <code>ul#portfolio-nav</code> (which is inserted into the DOM before <code>ul#portfolio</code>. When one of the thumbnail images (in the navigation menu) is clicked it dims to 0.8 opacity to show the user what slides they&#8217;ve already viewed, then it uses jQuery&#8217;s <code>animate</code> method to smoothly change the <code>left</code> CSS property of <code>ul#portfolio</code> to match the offset of the selected slide. I hope the comments in the code above are sufficient, if you have any questions feel free to ask below.</p>
<p><strong><a href="http://qd9.co.uk/me/demos/portfolio1/">The DEMO</a></strong> shows a very basic example of what can be achieved with the above JavaScript, obviously you could achieve something far snazzier with a little bit more CSS&#8230;</p>
<p><a href="http://qd9.co.uk/me/demos/hz-jquery-portfolio.zip">Download the demo ZIP</a></p>]]></content:encoded>
			<wfw:commentRss>http://enhance.qd-creative.co.uk/2008/10/26/how-to-make-a-navigable-horizontally-scrollable-portfolio/feed/</wfw:commentRss>
		</item>
		<item>
		<title>7 things you can do so your users won&#8217;t leave</title>
		<link>http://enhance.qd-creative.co.uk/2008/10/14/7-things-you-can-do-so-your-users-wont-leave/</link>
		<comments>http://enhance.qd-creative.co.uk/2008/10/14/7-things-you-can-do-so-your-users-wont-leave/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 20:32:10 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Accessibility]]></category>

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

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

		<guid isPermaLink="false">http://enhance.qd-creative.co.uk/?p=89</guid>
		<description><![CDATA[Instead of trying to constantly impress users with snazzy graphics and smooth flash movies lets go back to the basics and think about the what they like and what they hate. You may think your site is usable, good-looking, easily navigable and fast&#8230; but do your users agree?
So, here are seven things you can do [...]]]></description>
			<content:encoded><![CDATA[<p>Instead of trying to constantly impress users with snazzy graphics and smooth flash movies lets go back to the basics and think about the what they like and what they hate. You may think your site is usable, good-looking, easily navigable and fast&#8230; but do your users agree?</p>
<p>So, here are seven things you can do to make sure your users stay for more than five seconds:</p>
<span id="more-89"></span>
<ol class="imglist">
	<li>
		<div class="content-image-left"><img src="http://enhance.qd-creative.co.uk/images/posts/2008/7thingsyoucando/logo.png" alt="logo" width="180" height="120" /></div>
		<h3>Get a logo</h3>
		<p>A logo is the first step in creating a solid and memorable brand. Your entire website speaks for itself so make sure it says the right things and get yourself a logo. This is especially important if the name of your site is either really common or really complicated - normally, having a logo will aid your users in remembering your brand and your website.</p>
		<ul>
			<li><a href="http://www.fuelyourcreativity.com/50-kick-ass-logos-for-inspiration/">50+ Kick Ass Logos for Inspiration</a></li>
			<li><a href="http://faveup.com/">Faveup - A gallery of inspirational logo design</a></li>
			<li><a href="http://www.logoorange.com/logo-design-08.php">10 trends that will define logo design in 2008</a></li>
		</ul>
	</li>
	<li>
		<div class="content-image-left"><img src="http://enhance.qd-creative.co.uk/images/posts/2008/7thingsyoucando/contact.png" alt="logo" width="180" height="120" /></div>
		<h3>Provide a method of contact</h3>
		<p>Don&#8217;t leave your users clueless when they want to tell you something. You should give them at least one way to contact you, whether it be an email address, your Linked-In profile or a contact form. Personally I prefer contact forms because they normally provide the quickest way to contact someone. When you list your email address please don&#8217;t make it into a &#8216;mailto&#8217; link and please don&#8217;t write it in plain format (person@email.com) - this is just stupid - when I see this I think, &quot;Well, whoever made this website must be an idiot who knows nothing about spam bots!&quot; (a little harsh, I know) Instead of plain email format write it how a human would understand, for example: &quot;You can contact me be emailing John at my-website dot com.&quot;</p>
		<ul>
			<li><a href="http://wordpress.org/extend/plugins/contact-form-7/">Contact Form 7 - A wordpress plugin</a></li>
			<li><a href="http://tech.yahoo.com/blogs/hughes/26347">Hide your email address from spammers</a></li>
			<li><a href="http://www.tele-pro.co.uk/scripts/contact_form/">Website Contact Form Generator</a></li>
		</ul>
	</li>
	<li>
		<div class="content-image-left"><img src="http://enhance.qd-creative.co.uk/images/posts/2008/7thingsyoucando/lie.jpg" alt="logo" width="180" height="120" /></div>
		<h3>Have an honest &quot;about&quot; page</h3>
		<p>Website creation 101 teaches you to create an &#8216;about me&#8217; / &#8216;about us&#8217; page but what it does not teach you is what to put on that page. Please be honest! If you&#8217;re an individual then don&#8217;t say &quot;we are a company&quot;, instead say &quot;I am an individual.&quot; Also, when a user goes to an about page they expect to see actual information about the site and/or it&#8217;s owners/creators, not some marketing drivel which doesn&#8217;t actually say anything worthwhile!</p>
		<ul>
			<li><a href="http://www.problogger.net/archives/2006/11/24/how-to-write-your-about-me-page/">How to write an &quot;About me&quot; page</a><a href="http://www.tele-pro.co.uk/scripts/contact_form/"></a></li>
		</ul>
	</li>
	<li>
		<div class="content-image-left"><img src="http://enhance.qd-creative.co.uk/images/posts/2008/7thingsyoucando/speed.jpg" alt="logo" width="180" height="120" /></div>
		<h3>Speed up your website</h3>
		<p>A slow website is the ultimate turnoff for a first-time user. Make sure your website is well optimised - this means your images, scripts, StyleSheets and flash movies have to be optimised down to the smallest size possible  (without losing too much quality). Also make sure your hosting package isn&#8217;t holding you back, spending a bit extra on hosting can save both you and your users precious time, it&#8217;s definitely worth the expense. Also, try and reduce the amount of pages a user has to visit - obviously keep content separate but if you&#8217;ve got something like a login form on a page of it&#8217;s own then navigating there is just a waste of time for the user; instead you might want to consider integrating the login form on the homepage.</p>
		<ul>
			<li><a href="http://developer.yahoo.com/performance/rules.html">Yahoo: Best practices for speeding up your website</a></li>
			<li><a href="http://www.palmerwebmarketing.com/blog/25-ways-to-speed-up-your-website/">25 Ways to Speed up your website</a></li>
		</ul>
	</li>
	<li>
		<div class="content-image-left"><img src="http://enhance.qd-creative.co.uk/images/posts/2008/7thingsyoucando/validate.jpg" alt="logo" width="180" height="120" /></div>
		<h3>Validate!</h3>
		<p>Form validation is not just for your benefit, the user loves it too! As long as it&#8217;s intuitive and doesn&#8217;t require a lot of waiting time data validation can really enhance the user&#8217;s experience. If possible, use client-side scripting to achieve this - obviously a server-side solution does need to be in place but it&#8217;s always nice to have a speedier alternative (JavaScript). I don&#8217;t know about the rest of the world but what I prefer is when it all happens on the fly. So, when I&#8217;m entering my required username I will get immediate feedback on whether that username is available or not, instead of having to click submit and re-enter my password and un-tick those stupid &quot;subscribe&quot; checkboxes!</p>
		<ul>
			<li><a href="http://www.w3schools.com/jS/js_form_validation.asp">Basic JavaScript form validation (w3 Schools)</a></li>
			<li><a href="http://jqueryfordesigners.com/using-ajax-to-validate-forms/">Using Ajax to validate forms</a></li>
			<li><a href="http://docs.jquery.com/Plugins/Validation">jQuery (JavaScript library) validation plugin</a></li>
		</ul>
	</li>
	<li>
		<div class="content-image-left"><img src="http://enhance.qd-creative.co.uk/images/posts/2008/7thingsyoucando/human.jpg" alt="logo" width="180" height="120" /></div>
		<h3>Treat them like humans</h3>
		<p>Don&#8217;t make your human users feel like bots. The need to minimize spam is understandable but please use things like <a href="http://www.captcha.net/">CAPTCHA</a> only when you have to. And when marking-up links and deciding which phrases should be links take humans into account before the search engines.</p>
		<ul>
			<li><a href="http://www.456bereastreet.com/archive/200611/click_here_and_other_meaningless_link_phrases/">&#8216;Click here&#8217; and other meaningless link phrases</a></li>
			<li><a href="http://www.alistapart.com/articles/humantohuman">A-list-Apart: Human-to-Human Design</a></li>
			<li><a href="http://www.bestkungfu.com/archive/date/2004/03/matt-presents-escape-from-captcha/">Escape from CAPTCHA</a></li>
		</ul>
	</li>
	<li>
		<div class="content-image-left"><img src="http://enhance.qd-creative.co.uk/images/posts/2008/7thingsyoucando/js.jpg" alt="logo" width="180" height="120" /></div>
		<h3>Write JavaScript which degrades, gracefully</h3>
		<p>I am totally SICK of people who deny the importance of this practice. For all those out there who don&#8217;t quite understand the concept listen up!</p>
		<p>Graceful degradation is the process through which an application or website&#8217;s function degrades smoothly without presenting the user with functionless elements or features. Some people out there will tell you that it&#8217;s not very important anymore because *most* people have JavaScript enabled. Regardless of the majority you have to cater to as many people as possible. If a user doesn&#8217;t have JavaScript enabled and you haven&#8217;t bothered to make sure your code degrades, all you&#8217;re going to do is confuse that user! Graceful degradation comes hand in hand with <a href="http://www.webcredible.co.uk/user-friendly-resources/dom-scripting/progressive-enhancement.shtml">progressive enhancement</a> so make sure you take both into account, always!</p>
		<ul>


			<li><a href="http://webtips.dan.info/graceful.html">Graceful Degradation for the beginner</a></li>
			<li><a href="http://accessites.org/site/2007/02/graceful-degradation-progressive-enhancement/">Graceful Degradation &amp; Progressive Enhancement</a></li>
			<li><a href="http://www.alistapart.com/articles/understandingprogressiveenhancement">Understanding Progressive Enhancement</a></li>
		</ul>
	</li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://enhance.qd-creative.co.uk/2008/10/14/7-things-you-can-do-so-your-users-wont-leave/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New website finally finished</title>
		<link>http://enhance.qd-creative.co.uk/2008/10/05/new-website-finally-finished/</link>
		<comments>http://enhance.qd-creative.co.uk/2008/10/05/new-website-finally-finished/#comments</comments>
		<pubDate>Sun, 05 Oct 2008 10:18:18 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[General]]></category>

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

		<guid isPermaLink="false">http://enhance.qd-creative.co.uk/?p=82</guid>
		<description><![CDATA[I&#8217;ve finally managed to get my personal website built and running. I meant to get it done ages ago but so much had been happening that I simply didn&#8217;t have time.
My new website will act as a portfolio and a personal blog. Like all other great things in the world the site is built on [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finally managed to get my personal website built and running. I meant to get it done ages ago but so much had been happening that I simply didn&#8217;t have time.</p>
<p>My new website will act as a portfolio and a personal blog. Like all other great things in the world the site is built on <a href="http://wordpress.org/">Wordpress</a> and themed by me.</p>
<p><a href="http://james.padolsey.com"><strong>See the site now - james.padolsey.com &raquo;</strong></a></p>
<span id="more-82"></span>
<p>The design of the site is quite conventional, there are however a couple of cool features which I think are worth mentioning. The site features a &quot;hand-built&quot; jQuery Ajax contact form which probably isn&#8217;t even worth mentioning because they are so common nowadays. I was considering using a Wordpress plugin which does this all automaitcally  but all the ones I looked at were far too bloated so I went ahead and made my own. I&#8217;m also looking into Ajax&#8217;ing the commenting process on the blog&#8230; Although that won&#8217;t be for a while. </p>
<p>Another feature is the &quot;customize&quot; option. If you have JavaScript enabled you should be able to see a box in the upper right hand corner of the site which, if you click on, an array of colourful options will slide down. I was going to implement a colour picker so users have full control but I decided against it because a pre-defined set of colours (which had been tested to look good) made more sense. So, if you click on the colour of your choice various elements of the page should &quot;magically&quot; change accordingly. Additionally this feature will set a cookie in your browser so that you next time you visit your preference will be retained! </p>
<p>Please <a href="http://feeds.feedburner.com/JamesPadolsey?format=html">subscribe to my new blog</a>&#8230; It won&#8217;t all be about personal stuff, hopefully I&#8217;ll get a couple of webdev related posts up in the near future.</p>]]></content:encoded>
			<wfw:commentRss>http://enhance.qd-creative.co.uk/2008/10/05/new-website-finally-finished/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Cool Characters in Twitter - A GreaseMonkey Script!</title>
		<link>http://enhance.qd-creative.co.uk/2008/09/19/cool-characters-in-twitter-a-greasemonkey-script/</link>
		<comments>http://enhance.qd-creative.co.uk/2008/09/19/cool-characters-in-twitter-a-greasemonkey-script/#comments</comments>
		<pubDate>Fri, 19 Sep 2008 20:37:36 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[General]]></category>

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

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

		<guid isPermaLink="false">http://enhance.qd-creative.co.uk/?p=71</guid>
		<description><![CDATA[Recently there&#8217;s been some &#34;hype&#34; around the previously unknown fact that Twitter accepts cool UTF-8 characters. To be honest I never really assumed otherwise but the story covering it got over 2000 diggs today so I&#8217;m probably in the minority.
The actual story which was dugg was offering a bookmarklet which you can press to bring [...]]]></description>
			<content:encoded><![CDATA[<p>Recently there&#8217;s been some &quot;hype&quot; around the previously unknown fact that Twitter accepts cool UTF-8 characters. To be honest I never really assumed otherwise but the story covering it got over 2000 diggs today so I&#8217;m probably in the minority.</p>
<p>The <a href="http://digg.com/programming/TwitterKeys_h_s_in_Twitter">actual story which was dugg</a> was offering a bookmarklet which you can press to bring up a popup window which enabled you to copy (*gasp*) and paste (*gasp*) funny characters into your tweets. The only problem with this being that it is manual and not really worth the effort&#8230; not even slightly! I&#8217;m quite lazy so cannot be bothered to open a new window&#8230; go into that new window&#8230; highlight a bit of text&#8230; copy it&#8230; select the twitter window&#8230; and then paste it into the textbox! So, spending that wouldbe wasted time I created a sweet little GreaseMonkey script which does all of it for you!</p>
<span id="more-71"></span>
<p><strong>You can download it from UserScript.org here &gt; <a href="http://userscripts.org/scripts/show/34024">UserScripts.org/scripts/show/34024</a></strong></p>
<p><a href="http://enhance.qd-creative.co.uk/images/posts/TWITss.png">Screenshot (click for larger):</a></p>
<a href="http://enhance.qd-creative.co.uk/images/posts/TWITss.png"><img src="http://enhance.qd-creative.co.uk/images/posts/TWITss1.png" alt="Twitter GM script Preview" width="400" height="255" /></a>]]></content:encoded>
			<wfw:commentRss>http://enhance.qd-creative.co.uk/2008/09/19/cool-characters-in-twitter-a-greasemonkey-script/feed/</wfw:commentRss>
		</item>
		<item>
		<title>&#8220;seekAttention&#8221; - jQuery plugin</title>
		<link>http://enhance.qd-creative.co.uk/2008/09/17/seek-attention-jquery-plugin/</link>
		<comments>http://enhance.qd-creative.co.uk/2008/09/17/seek-attention-jquery-plugin/#comments</comments>
		<pubDate>Wed, 17 Sep 2008 21:40:44 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://enhance.qd-creative.co.uk/?p=67</guid>
		<description><![CDATA[Recently I&#8217;ve been working on a brand new plugin for jQuery. It&#8217;s not quite finished and it&#8217;s in the &#34;experimental&#34; stages but I think it&#8217;s progressed enough for a release.
The new plugin is called &#34;seekAttention&#34; and allows any element on a page to seek the users attention&#8230; with added effects! I&#8217;ve been careful to take [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve been working on a brand new plugin for jQuery. It&#8217;s not quite finished and it&#8217;s in the &quot;experimental&quot; stages but I think it&#8217;s progressed enough for a release.</p>
<p>The new plugin is called &quot;seekAttention&quot; and allows any element on a page to seek the users attention&#8230; with added effects! I&#8217;ve been careful to take usability and customization into account with this plugin. It&#8217;s fully automated - it detects element size and builds an overlay to suit that element and you have a number of options so you get to decide how the plugin behaves.</p>
<span id="more-67"></span>
<p>It&#8217;s hard to explain exactly what it does so <strong>please have a look here: <a href="/demo/seekAttention/">seekAttention jQuery plugin</a></strong>.</p>
<p>If you have any comments, questions or any bugs to raise please leave a comment on this blog post. As it&#8217;s an experimental plugin there are bound to be a few minor issues, especially with older browsers.</p>]]></content:encoded>
			<wfw:commentRss>http://enhance.qd-creative.co.uk/2008/09/17/seek-attention-jquery-plugin/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Google Chrome</title>
		<link>http://enhance.qd-creative.co.uk/2008/09/02/google-chrome/</link>
		<comments>http://enhance.qd-creative.co.uk/2008/09/02/google-chrome/#comments</comments>
		<pubDate>Tue, 02 Sep 2008 21:17:04 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://enhance.qd-creative.co.uk/?p=55</guid>
		<description><![CDATA[Originally I wasn&#8217;t looking forward to the launch of Google Chrome for one reason - it&#8217;s *another* browser which us web developers have to cater for. But since I heard it is based on the not-so-bad WebKit rendering engine I started getting excited. What does this mean for Firefox though - can they compete with [...]]]></description>
			<content:encoded><![CDATA[<p>Originally I wasn&#8217;t looking forward to the launch of Google Chrome for one reason - it&#8217;s *another* browser which us web developers have to cater for. But since I heard it is based on the not-so-bad WebKit rendering engine I started getting excited. What does this mean for Firefox though - can they compete with Apple and Google (both WebKit)!? The new Google browser is not just another duck in the pond either; they have completely rethought the typical browser interface and have added a bunch of features making the browser experience better for users and the developing experience better for us developers.</p>

<span id="more-55"></span>

<p>At 7pm (I&#8217;m in the UK) I downloaded my copy of Chrome (from here: <a href="http://www.google.com/chrome">google.com/chrome</a>) and installed it straight away. I&#8217;ve prepared some juicy screenshots for those too tired to read:</p>
<div class="thumbs">
	<a href="http://enhance.qd-creative.co.uk/images/chrome/ss1.jpg"><img src="http://enhance.qd-creative.co.uk/images/chrome/ss1-t.jpg" alt="screenshot 1" /></a>
	<a href="http://enhance.qd-creative.co.uk/images/chrome/ss3.jpg"><img src="http://enhance.qd-creative.co.uk/images/chrome/ss3-t.jpg" alt="screenshot 3" /></a>
	<a href="http://enhance.qd-creative.co.uk/images/chrome/ss4.jpg"><img src="http://enhance.qd-creative.co.uk/images/chrome/ss4-t.jpg" alt="screenshot 4" /></a>
	<a href="http://enhance.qd-creative.co.uk/images/chrome/ss5.jpg"><img src="http://enhance.qd-creative.co.uk/images/chrome/ss5-t.jpg" alt="screenshot 5" /></a>
	<a href="http://enhance.qd-creative.co.uk/images/chrome/ss6.jpg"><img src="http://enhance.qd-creative.co.uk/images/chrome/ss6-t.jpg" alt="screenshot 6" /></a>
	<a href="http://enhance.qd-creative.co.uk/images/chrome/ss7.jpg"><img src="http://enhance.qd-creative.co.uk/images/chrome/ss7-t.jpg" alt="screenshot 7" /></a>
	<a href="http://enhance.qd-creative.co.uk/images/chrome/ss8.jpg"><img src="http://enhance.qd-creative.co.uk/images/chrome/ss8-t.jpg" alt="screenshot 8" /></a>
	<a href="http://enhance.qd-creative.co.uk/images/chrome/ss9.jpg"><img src="http://enhance.qd-creative.co.uk/images/chrome/ss9-t.jpg" alt="screenshot 9" /></a>
</div>
<h3>Features</h3>
<ul>
	<li><strong>One box for everything</strong>: Chrome has a multi-functional address bar allowing you to search multiple resources/sites and access sites by typing in their URL&#8217;s all into one box.</li>
	<li><strong>New tab page</strong>: Google Chrome automatically displays your most visited pages and search engines as well as recently closed bookmarks.</li>
	<li><strong>Application Shortcuts</strong>: Chrome allows you to create desktop-app like shortcuts to your online apps such as Google Mail or Google docs so instead of having to muddle around with tabs and bloated browsers you can open your app in a single window of it&#8217;s own - as if it were actually a desktop app!</li>
	<li><strong>Dynamic Tabs</strong>: Chrome has some neat features to let you control your tabs more easily.</li>
	<li><strong>Crash control</strong>: Since each tab is in a process of it&#8217;s own, if a website you&#8217;re visiting crashes and no longer responds it is only that single tab which has crashed instead of the entire program. </li>
	<li><strong>Incognito mode</strong>: Sometimes you won&#8217;t want you&#8217;re recently viewed items to be logged or available on the new tab page - Chrome&#8217;s inCognito mode is a more private way to surf the internet.</li>
	<li><strong>Importing settings</strong>: Much like other browsers, Chrome will import bookmarks and settings from other browsers.</li>
	<li><strong>New V8</strong>: The way Chrome runs JavaScript is totally revolutionary and is said to massively speed up the running or heavy web apps.</li>
	<li><strong>WebKit rendering engine</strong>: This is not bad news for web developers. Since the rendering engine is the same as Safari&#8217;s there will be little need to worry about incompatibilities. </li>
</ul>
<h4>So&#8230; Firefox, Safari, Opera or&#8230; Chrome?</h4>
<p>Chrome looks and feels wonderful. I&#8217;ve only been using it for a couple of hours and already find it a very fast and fluid experience. However, there is no way I am ditching Firefox&#8217;s flexibility/expandability or Opera&#8217;s security/speed for something which is still only in beta. I think I will definitely keep Chrome installed and I will hopefully make use of it. I know for a fact that I&#8217;ll be running Google Mail on it from tonight onwards!</p>
<p>I am looking forward to the next few releases of this awesome browser!</p>
<p>Thank you Google! <img src='http://enhance.qd-creative.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Related Links</h3>
<ul>
	<li><a href="http://chrome-forum.net">Google Chrome Forum!</a></li>
	<li><a href="http://www.google.com/chrome/?hl=en-GB">Google Chrome Homepage</a></li>
	<li><a href="http://googleblog.blogspot.com/2008/09/fresh-take-on-browser.html">A fresh take on the browser - Google Blog</a></li>
	<li><a href="http://blogs.guardian.co.uk/technology/2008/09/02/firefox_boss_responds_to_googles_chrome.html">Firefox boss responds to Google&#8217;s Chrome</a></li>
	<li><a href="http://ejohn.org/blog/google-chrome-process-manager/">Google Chrome Process Manager</a></li>
	<li><a href="http://technologizer.com/2008/09/01/ten-questions-about-google-chrome/">Ten Questions About Google Chrome</a></li>
	<li><a href="http://blogoscoped.com/google-chrome/">Google on Google Chrome - comic book</a></li>
	<li><a href="http://blogoscoped.com/archive/2008-09-02-n72.html">Google Chrome Screenshots</a></li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://enhance.qd-creative.co.uk/2008/09/02/google-chrome/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Style Switcher - *Non* jQuery version</title>
		<link>http://enhance.qd-creative.co.uk/2008/08/27/jquery-theme-switcher-follow-up-notes/</link>
		<comments>http://enhance.qd-creative.co.uk/2008/08/27/jquery-theme-switcher-follow-up-notes/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 08:26:50 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[CSS]]></category>

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

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

		<guid isPermaLink="false">http://enhance.qd-creative.co.uk/?p=44</guid>
		<description><![CDATA[A tutorial that I wrote explaining how to develop a degradable style switcher in jQuery and PHP has just been published on NETTUTS.
I thought it would be a good idea to expand on the tutorial for the benefit of those who want to integarete the style-switcher into their own website.

In the tutorial, we made use [...]]]></description>
			<content:encoded><![CDATA[<p>A tutorial that I wrote explaining <a href="http://www.nettuts.com/javascript-ajax/jquery-style-switcher/">how to develop a degradable style switcher in jQuery and PHP</a> has just been published on NETTUTS.</p>
<p>I thought it would be a good idea to expand on the tutorial for the benefit of those who want to integarete the style-switcher into their own website.</p>
<span id="more-44"></span>
<p>In the tutorial, we made use of the popular JavaScript library, jQuery. I&#8217;m a big fan of jQuery and think it&#8217;s a time-saver and definitely something you should pursue if you want to add UX enhancements throughout your site. Though in some situations it&#8217;s not a good idea to use jQuery; if you&#8217;re only using it for a couple of features within your site then it might be better to just write the actual JavaScript instead, to save space. (jQuery.min is ~50k!)</p>
<p>So, for anyone you wants it, I have written the <strong>non</strong>-jQuery version.</p>
<p>NOTE: Just like the jQuery version it works in IE6, IE7, Opera, FF and Safari. If you followed the concepts outlined in <a href="http://www.nettuts.com/javascript-ajax/jquery-style-switcher/">the tutorial</a> then it shouldn&#8217;t be too hard to see what&#8217;s going on here. - Since I&#8217;m using no library it&#8217;s bound to be a longer script; &quot;one line with jQuery is several lines without it!&quot;</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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
</pre></td><td class="code"><pre class="javascript"><span style="color: #003366; font-weight: bold;">var</span> styleSwitcher <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">// Begin script:</span>
	init<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: #006600; font-style: italic;">// Initialise the CSS dummy method:</span>
		<span style="color: #006600; font-style: italic;">// (If you don't know what this is then read through the NETTUTS tutorial!)</span>
		styleSwitcher.<span style="color: #006600;">cssDummy</span>.<span style="color: #006600;">init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #006600; font-style: italic;">// Specify container of the links (&lt;A&gt;) to different styles:</span>
		<span style="color: #003366; font-weight: bold;">var</span> ss <span style="color: #339933;">=</span> document.<span style="color: #006600;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'style-switcher'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #006600; font-style: italic;">// If it exists on the page:</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>ss<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">// Get anchors within the container and assing length to variable:</span>
			<span style="color: #003366; font-weight: bold;">var</span> ssLinks <span style="color: #339933;">=</span> ss.<span style="color: #006600;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> l <span style="color: #339933;">=</span> ssLinks.<span style="color: #006600;">length</span><span style="color: #339933;">;</span>
			<span style="color: #006600; font-style: italic;">// Loop through all anchors:</span>
			<span style="color: #000066; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>l<span style="color: #339933;">--</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #006600; font-style: italic;">// Assign onclick event:</span>
				ssLinks<span style="color: #009900;">&#91;</span>l<span style="color: #009900;">&#93;</span>.<span style="color: #006600;">onclick</span> <span style="color: #339933;">=</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> href <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">href</span><span style="color: #339933;">;</span>
					<span style="color: #006600; font-style: italic;">// Load the stylesheet:</span>
					styleSwitcher.<span style="color: #006600;">loadStyleSheet</span><span style="color: #009900;">&#40;</span>href<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</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;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	loadStyleSheet<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>href<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #006600; font-style: italic;">// Create new overlay DIV element and style it:</span>
		<span style="color: #006600; font-style: italic;">// (applyCSS is another method)</span>
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>document.<span style="color: #006600;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'overlay'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003366; font-weight: bold;">var</span> overlay <span style="color: #339933;">=</span> document.<span style="color: #006600;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'div'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			overlay.<span style="color: #006600;">id</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;overlay&quot;</span><span style="color: #339933;">;</span>
			styleSwitcher.<span style="color: #006600;">applyCSS</span><span style="color: #009900;">&#40;</span>document.<span style="color: #006600;">body</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>height<span style="color: #339933;">:</span><span style="color: #3366CC;">'100%'</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// For IE6</span>
			styleSwitcher.<span style="color: #006600;">applyCSS</span><span style="color: #009900;">&#40;</span>overlay<span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
				position<span style="color: #339933;">:</span> <span style="color: #3366CC;">'absolute'</span><span style="color: #339933;">,</span>
				top<span style="color: #339933;">:</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>
				left<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>
				width<span style="color: #339933;">:</span> <span style="color: #3366CC;">'100%'</span><span style="color: #339933;">,</span>
				height<span style="color: #339933;">:</span> <span style="color: #3366CC;">'100%'</span><span style="color: #339933;">,</span>
				zIndex<span style="color: #339933;">:</span> <span style="color: #CC0000;">1000</span><span style="color: #339933;">,</span>
				background<span style="color: #339933;">:</span> <span style="color: #3366CC;">'black url(img/loading.gif) no-repeat center'</span><span style="color: #339933;">,</span>
				opacity<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>
				filter<span style="color: #339933;">:</span> <span style="color: #3366CC;">'alpha(opacity=0)'</span>
			<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #006600; font-style: italic;">// Append our overlay to the document:</span>
			document.<span style="color: #006600;">body</span>.<span style="color: #006600;">appendChild</span><span style="color: #009900;">&#40;</span>overlay<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: #003366; font-weight: bold;">var</span> overlay <span style="color: #339933;">=</span> document.<span style="color: #006600;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'overlay'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #006600; font-style: italic;">// Fade in the overlay</span>
		styleSwitcher.<span style="color: #006600;">fadeIn</span><span style="color: #009900;">&#40;</span>overlay<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: #006600; font-style: italic;">// Callback function: Get response from style-switcher.php:</span>
			styleSwitcher.<span style="color: #006600;">AJAX</span>.<span style="color: #006600;">load</span><span style="color: #009900;">&#40;</span>href <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&amp;js'</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #006600; font-style: italic;">// Do stuff with the data response:</span>
				<span style="color: #003366; font-weight: bold;">var</span> link <span style="color: #339933;">=</span> document.<span style="color: #006600;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'stylesheet'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>link<span style="color: #009900;">&#41;</span> link.<span style="color: #006600;">href</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'css/'</span> <span style="color: #339933;">+</span> data <span style="color: #339933;">+</span> <span style="color: #3366CC;">'.css'</span><span style="color: #339933;">;</span>
				<span style="color: #006600; font-style: italic;">// Initiliase the &quot;check&quot; method of cssDummy:</span>
				styleSwitcher.<span style="color: #006600;">cssDummy</span>.<span style="color: #006600;">check</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: #006600; font-style: italic;">// Once CSS has loaded fade-out the overlay:</span>
					styleSwitcher.<span style="color: #006600;">fadeOut</span><span style="color: #009900;">&#40;</span>overlay<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: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	<span style="color: #006600; font-style: italic;">// It makes sense to make a quick method to apply CSS rules to elements:</span>
	applyCSS<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>element<span style="color: #339933;">,</span>styles<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #006600; font-style: italic;">// If styles are passed in as an object the proceed:</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> styles <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;object&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">// We don't want an array though:</span>
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>styles<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #006600; font-style: italic;">// Loop through array and apply styles:</span>
				<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #000066; font-weight: bold;">in</span> styles<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					element.<span style="color: #006600;">style</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> styles<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	<span style="color: #006600; font-style: italic;"