<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0"><channel><title>Musings of ErisDS</title> <link>http://erisds.co.uk</link> <description>Web development, Symfony, Wordpress and general geekery</description> <lastBuildDate>Tue, 19 Jan 2010 18:54:13 +0000</lastBuildDate> <generator>http://wordpress.org/?v=2.9.1</generator> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/erisds" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="erisds" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><title>What is WRONG with my iPhone?</title><link>http://erisds.co.uk/technology/what-is-wrong-with-my-iphone</link> <comments>http://erisds.co.uk/technology/what-is-wrong-with-my-iphone#comments</comments> <pubDate>Tue, 19 Jan 2010 08:05:04 +0000</pubDate> <dc:creator>ErisDS</dc:creator> <category><![CDATA[Technology]]></category> <category><![CDATA[apple]]></category> <category><![CDATA[bugs]]></category> <category><![CDATA[iPhone]]></category><guid isPermaLink="false">http://erisds.co.uk/?p=979</guid> <description><![CDATA[I've already filed a report on the Apple website &#038; am about to go phone them for help. I'm not expecting much &#038; I'm getting seriously frustrated. Maybe it's only on Windows 7, but the iPhone syncing progress seems to have some serious flaws.Related posts:<ol><li><a
href='http://erisds.co.uk/general/2009-review-and-aims-final-part' rel='bookmark' title='Permanent Link: 2009 Review and Aims Final Part'>2009 Review and Aims Final Part</a> <small>Short, honest and to the point. The last 5 months...</small></li></ol>]]></description> <content:encoded><![CDATA[<div
id="attachment_980" class="wp-caption alignleft" style="width: 310px"><a
href="http://www.flickr.com/photos/shht/"><img
class="size-full wp-image-980" title="iPhone problems" src="http://erisds.co.uk/wp-content/uploads/2010/01/iPhone.png" alt="" width="300" height="326" /></a><p
class="wp-caption-text">Photo by Shht!</p></div><p>I&#8217;ve already filed a report on the Apple website &amp; am about to go phone them for help. I&#8217;m not expecting much &amp; I&#8217;m getting seriously frustrated. Maybe it&#8217;s only on Windows 7, but the iPhone syncing process seems to have some serious flaws.</p><p>I&#8217;ve had an iPhone for exactly a month today. In that time I have come to be totally addicted &amp; completely in love with the device. It&#8217;s sleek, stylish, easy-to-use and does everything I need from the device in my pocket. But it&#8217;s also BUGGY, really, really BUGGY to the point where it&#8217;s almost useless.</p><p>Just after Christmas I made the mistake of syncing my phone on my work machine, such that everything was erased from the phone. Ok, silly mistake, but <strong>it shouldn&#8217;t be that easy</strong> to wipe your mobile phone! When I got home and tried to sync everything back &#8211; it wouldn&#8217;t.</p><p>Each time I attempted to sync it would throw 3 or 4 unintelligable errors messages and then <strong>iTunes would refuse to recognised my iPhone</strong>. I&#8217;d then have to do a restore &amp; start over with the sync. Eventually I realised I could sync only by syncing 1 or 2 apps at a time &#8211; not the whole lot. Problem solved. No more accidental work syncing for me!</p><p>Last week I connected my phone up for a routine sync &#8211; I had some new music I wanted to get onto the phone for the weekend &#8211; but again it threw 3 or 4 unintelligable errors (like -48, -49 and -2ksomething) and <strong>failed to sync</strong>. Everything seemed ok with the iPhone, however halfway through my weekend away my apps started to do the <strong>&#8220;flash-and-crash&#8221;</strong> thing. This has happened before and turning the iPhone off and on again normally fixes it, but not this time! I read that some people had found <strong>installing a new app fixes it</strong>, so I tried that and luckily it worked.</p><p>Now I&#8217;m home and my iPhone isn&#8217;t recognised by iTunes anymore. I get a message saying &#8220;an iPhone has been previously synced with the machine&#8221; and allowing me to either set the iPhone up as a <strong>new phone</strong>, or<strong> restore from a really old backup</strong>. In addition, when using the<strong> iPod function it only plays one track and then crashes</strong>.</p><p>I&#8217;ve tried searching the net to see if others have this issue, and if there&#8217;s something I&#8217;m doing wrong. Maybe it&#8217;s Windows 7, maybe it&#8217;s cos I&#8217;m using Google Sync, or maybe there is some rogue app causing havoc during the syncing process. All I know is that losing all my data every 2 weeks is rendering my iPhone totally useless.</p><p>&lt;/rant&gt;</p><p>Related posts:<ol><li><a
href='http://erisds.co.uk/general/2009-review-and-aims-final-part' rel='bookmark' title='Permanent Link: 2009 Review and Aims Final Part'>2009 Review and Aims Final Part</a> <small>Short, honest and to the point. The last 5 months...</small></li></ol></p>]]></content:encoded> <wfw:commentRss>http://erisds.co.uk/technology/what-is-wrong-with-my-iphone/feed</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Snippet: Wordpress – Customise the Excerpt Length and More string</title><link>http://erisds.co.uk/wordpress/snippet-wordpress-customise-the-excerpt-length-and-more-string</link> <comments>http://erisds.co.uk/wordpress/snippet-wordpress-customise-the-excerpt-length-and-more-string#comments</comments> <pubDate>Fri, 15 Jan 2010 18:17:39 +0000</pubDate> <dc:creator>ErisDS</dc:creator> <category><![CDATA[Wordpress]]></category> <category><![CDATA[snippet]]></category> <category><![CDATA[web development]]></category><guid isPermaLink="false">http://erisds.co.uk/?p=944</guid> <description><![CDATA[These functions and hooks let you customise the output of <kbd>the_excerpt()</kbd> template tag. Just copy and paste into the <kbd>functions.php</kbd> file in your theme. This works for both posts and pages.Related posts:<ol><li><a
href='http://erisds.co.uk/symfony/snippet-symfony-user-access-the-user-object' rel='bookmark' title='Permanent Link: Snippet: Symfony User &#8211; Access the User Object'>Snippet: Symfony User &#8211; Access the User Object</a> <small>The following snippets provide access to the Symfony User object...</small></li><li><a
href='http://erisds.co.uk/symfony/snippet-symfony-forms-setting-default-values' rel='bookmark' title='Permanent Link: Snippet: Symfony Forms &#8211; Setting Default Values'>Snippet: Symfony Forms &#8211; Setting Default Values</a> <small>I often forget how to set default values for form...</small></li><li><a
href='http://erisds.co.uk/symfony/snippet-symfony-forms-allowing-extra-fields' rel='bookmark' title='Permanent Link: Snippet: Symfony Forms &#8211; Allowing Extra Fields'>Snippet: Symfony Forms &#8211; Allowing Extra Fields</a> <small>Place this line of code in the configure method of...</small></li></ol>]]></description> <content:encoded><![CDATA[<p>These functions and hooks let you customise the output of <kbd>the_excerpt()</kbd> template tag. Just copy and paste into the <kbd>functions.php</kbd> file in your theme. This works for both posts and pages.</p><p>To change the excerpt length (how many words are output), define a function which returns the number you want and then call it with <kbd>add_filter()</kbd> on the &#8216;excerpt_length&#8217; filter as shown below.</p><div
class="codecolorer-container php twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table
cellspacing="0" cellpadding="0"><tbody><tr><td
style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br
/>2<br
/>3<br
/>4<br
/>5<br
/></div></td><td><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000000; font-weight: bold;">function</span> custom_excerpt_length<span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$length</span><span
style="color: #009900;">&#41;</span><br
/> <span
style="color: #009900;">&#123;</span><br
/> <span
style="color: #b1b100;">return</span> <span
style="color: #cc66cc;">20</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #009900;">&#125;</span><br
/> add_filter<span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">'excerpt_length'</span><span
style="color: #339933;">,</span> <span
style="color: #0000ff;">'custom_excerpt_length'</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span></div></td></tr></tbody></table></div><p>By default excerpts which are generated by <strong>Wordpress</strong> (as opposed to defined via the &#8220;Excerpt&#8221; box) have the string &#8220;[...]&#8221; You might want to turn this into a link to the post or page and/or change the dots to something like &#8220;more&#8221;. The code below does both of these things using <kbd>str_replace()</kbd>.</p><div
class="codecolorer-container php twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table
cellspacing="0" cellpadding="0"><tbody><tr><td
style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br
/>2<br
/>3<br
/>4<br
/>5<br
/>6<br
/></div></td><td><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000000; font-weight: bold;">function</span> custom_excerpt_more<span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$more</span><span
style="color: #009900;">&#41;</span><br
/> <span
style="color: #009900;">&#123;</span><br
/> <span
style="color: #000000; font-weight: bold;">global</span> <span
style="color: #000088;">$post</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #b1b100;">return</span> <a
href="http://www.php.net/str_replace"><span
style="color: #990000;">str_replace</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">'[...]'</span><span
style="color: #339933;">,</span> <span
style="color: #0000ff;">'&lt;a href=&quot;'</span><span
style="color: #339933;">.</span>get_permalink<span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$post</span><span
style="color: #339933;">-&amp;</span>gt<span
style="color: #339933;">;</span>ID<span
style="color: #009900;">&#41;</span><span
style="color: #339933;">.</span><span
style="color: #0000ff;">'&quot;&gt;...read more...&lt;/a&gt;'</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$more</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #009900;">&#125;</span><br
/> add_filter<span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">'excerpt_more'</span><span
style="color: #339933;">,</span> <span
style="color: #0000ff;">'custom_excerpt_more'</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span></div></td></tr></tbody></table></div><p>You can change the second parameter of <kbd>str_replace()</kbd> to whatever you want to be displayed. I included the <kbd>$post</kbd> global so that I could get the permalink and make the string into a link to the post/page.</p><p>Please note these will not work if you have any plugin installed which removes the excerpt hooks. One such plugin is the <a
href="http://wordpress.org/extend/plugins/event-calendar/">Event Calendar 3 plugin</a>. If you come across any more please let me know in the comments.</p><p
class="small"><strong>A Note on Snippets:</strong> When customising a CMS such as Wordpress it is often the simplest pieces of code which are the hardest to either find or remember. These snippets are placed here for my own reference and will hopefully be useful to others. If you find them useful or have any suggestions, please let me know.</p><p>Related posts:<ol><li><a
href='http://erisds.co.uk/symfony/snippet-symfony-user-access-the-user-object' rel='bookmark' title='Permanent Link: Snippet: Symfony User &#8211; Access the User Object'>Snippet: Symfony User &#8211; Access the User Object</a> <small>The following snippets provide access to the Symfony User object...</small></li><li><a
href='http://erisds.co.uk/symfony/snippet-symfony-forms-setting-default-values' rel='bookmark' title='Permanent Link: Snippet: Symfony Forms &#8211; Setting Default Values'>Snippet: Symfony Forms &#8211; Setting Default Values</a> <small>I often forget how to set default values for form...</small></li><li><a
href='http://erisds.co.uk/symfony/snippet-symfony-forms-allowing-extra-fields' rel='bookmark' title='Permanent Link: Snippet: Symfony Forms &#8211; Allowing Extra Fields'>Snippet: Symfony Forms &#8211; Allowing Extra Fields</a> <small>Place this line of code in the configure method of...</small></li></ol></p>]]></content:encoded> <wfw:commentRss>http://erisds.co.uk/wordpress/snippet-wordpress-customise-the-excerpt-length-and-more-string/feed</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Microsoft, Apple or Google for World Domination?</title><link>http://erisds.co.uk/general/microsoft-apple-or-google-for-world-domination</link> <comments>http://erisds.co.uk/general/microsoft-apple-or-google-for-world-domination#comments</comments> <pubDate>Wed, 13 Jan 2010 13:23:54 +0000</pubDate> <dc:creator>ErisDS</dc:creator> <category><![CDATA[General]]></category> <category><![CDATA[apple]]></category> <category><![CDATA[google]]></category> <category><![CDATA[microsoft]]></category><guid isPermaLink="false">http://erisds.co.uk/?p=946</guid> <description><![CDATA[If one of Microsoft, Apple or Google was definitely going to reach "Buy &#038; Large" (think Wall-e) style global domination - which would you rather?Related posts:<ol><li><a
href='http://erisds.co.uk/internet/down-with-ie6-tell-it-to-microsoft' rel='bookmark' title='Permanent Link: Down with IE6? Tell it to Microsoft'>Down with IE6? Tell it to Microsoft</a> <small>There has been much talk in the web design and...</small></li><li><a
href='http://erisds.co.uk/general/2009-review-and-aims-final-part' rel='bookmark' title='Permanent Link: 2009 Review and Aims Final Part'>2009 Review and Aims Final Part</a> <small>Short, honest and to the point. The last 5 months...</small></li><li><a
href='http://erisds.co.uk/technology/what-is-wrong-with-my-iphone' rel='bookmark' title='Permanent Link: What is WRONG with my iPhone?'>What is WRONG with my iPhone?</a> <small>I've already filed a report on the Apple website &...</small></li></ol>]]></description> <content:encoded><![CDATA[<p>If one of Microsoft, Apple or Google was definitely going to reach &#8220;Buy &#038; Large&#8221; (think Wall-e) style global domination &#8211; which would you rather?</p><p><script src="http://twtpoll.com/js/badge.js" type="text/javascript"></script><br
/> <script src="http://twtpoll.com/badge/?twt=mnxb0j&#038;s=250&#038;b=1&#038;bt=1" type="text/javascript"></script></p><p>Answer at <a
href="http://twtpoll.com/mnxb0j">twtpoll</a></p><p>Related posts:<ol><li><a
href='http://erisds.co.uk/internet/down-with-ie6-tell-it-to-microsoft' rel='bookmark' title='Permanent Link: Down with IE6? Tell it to Microsoft'>Down with IE6? Tell it to Microsoft</a> <small>There has been much talk in the web design and...</small></li><li><a
href='http://erisds.co.uk/general/2009-review-and-aims-final-part' rel='bookmark' title='Permanent Link: 2009 Review and Aims Final Part'>2009 Review and Aims Final Part</a> <small>Short, honest and to the point. The last 5 months...</small></li><li><a
href='http://erisds.co.uk/technology/what-is-wrong-with-my-iphone' rel='bookmark' title='Permanent Link: What is WRONG with my iPhone?'>What is WRONG with my iPhone?</a> <small>I've already filed a report on the Apple website &...</small></li></ol></p>]]></content:encoded> <wfw:commentRss>http://erisds.co.uk/general/microsoft-apple-or-google-for-world-domination/feed</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>I’ve signed up to Project52</title><link>http://erisds.co.uk/internet/ive-signed-up-to-project52</link> <comments>http://erisds.co.uk/internet/ive-signed-up-to-project52#comments</comments> <pubDate>Thu, 07 Jan 2010 23:15:52 +0000</pubDate> <dc:creator>ErisDS</dc:creator> <category><![CDATA[Internet]]></category> <category><![CDATA[blog]]></category> <category><![CDATA[resolutions]]></category><guid isPermaLink="false">http://erisds.co.uk/?p=913</guid> <description><![CDATA[<a
href="http://project52.info/"><img
src="http://erisds.co.uk/wp-content/uploads/2010/01/p52_300x377.png" alt="" title="p52_300x377" width="300" height="377" class="alignleft size-full wp-image-914" /></a>I've just signed up to Project52. Originally intended as a small group of friends supporting each other to reach their goals, there are now over 700 members and I'm really interested to see how this develops into a workable system.Last year I promised to write once a week and failed, so I'm hoping this might spur me on to achieve that goal this year. The intention is that a tracking system will be created to monitor progress of group members. If the system works (once it goes live) I'll also be <a
href="http://www.zazzle.com/anton/gifts?cg=196894207769697724">purchasing a mug</a> as a daily reminder - I just wish they did one in purple!Related posts:<ol><li><a
href='http://erisds.co.uk/personal/stay-on-top-of-the-game' rel='bookmark' title='Permanent Link: Stay on top of the game'>Stay on top of the game</a> <small>For 2010 I pledge to stay on top of the...</small></li><li><a
href='http://erisds.co.uk/general/2009-review-and-aims-part-ii' rel='bookmark' title='Permanent Link: 2009 Review and Aims Part II'>2009 Review and Aims Part II</a> <small>On the first of June I published a summary of...</small></li><li><a
href='http://erisds.co.uk/general/2009-review-and-aims-final-part' rel='bookmark' title='Permanent Link: 2009 Review and Aims Final Part'>2009 Review and Aims Final Part</a> <small>Short, honest and to the point. The last 5 months...</small></li></ol>]]></description> <content:encoded><![CDATA[<h3><a
href="http://project52.info/"><img
class="alignleft size-full wp-image-914" title="p52_300x377" src="http://erisds.co.uk/wp-content/uploads/2010/01/p52_300x377.png" alt="" width="300" height="377" /></a>I&#8217;ve just signed up to <a
href="http://project52.info/">Project52</a>.</h3><p>Originally intended as a small group of friends supporting each other to reach their goals, there are now over 700 members and I&#8217;m really interested to see how this develops into a workable system.</p><p>Last year I promised to write once a week and failed, so I&#8217;m hoping this might spur me on to achieve that goal this year. The intention is that a tracking system will be created to monitor progress of group members. If the system works (once it goes live) I&#8217;ll also be <a
href="http://www.zazzle.com/anton/gifts?cg=196894207769697724">purchasing a mug</a> as a daily reminder &#8211; I just wish they did one in purple!</p><p>Related posts:<ol><li><a
href='http://erisds.co.uk/personal/stay-on-top-of-the-game' rel='bookmark' title='Permanent Link: Stay on top of the game'>Stay on top of the game</a> <small>For 2010 I pledge to stay on top of the...</small></li><li><a
href='http://erisds.co.uk/general/2009-review-and-aims-part-ii' rel='bookmark' title='Permanent Link: 2009 Review and Aims Part II'>2009 Review and Aims Part II</a> <small>On the first of June I published a summary of...</small></li><li><a
href='http://erisds.co.uk/general/2009-review-and-aims-final-part' rel='bookmark' title='Permanent Link: 2009 Review and Aims Final Part'>2009 Review and Aims Final Part</a> <small>Short, honest and to the point. The last 5 months...</small></li></ol></p>]]></content:encoded> <wfw:commentRss>http://erisds.co.uk/internet/ive-signed-up-to-project52/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Stay on top of the game</title><link>http://erisds.co.uk/personal/stay-on-top-of-the-game</link> <comments>http://erisds.co.uk/personal/stay-on-top-of-the-game#comments</comments> <pubDate>Thu, 31 Dec 2009 23:01:19 +0000</pubDate> <dc:creator>ErisDS</dc:creator> <category><![CDATA[Personal]]></category> <category><![CDATA[gtd]]></category> <category><![CDATA[resolutions]]></category><guid isPermaLink="false">http://erisds.co.uk/?p=892</guid> <description><![CDATA[For 2010 I pledge to <strong>stay on top of the game</strong>.To keep my house clean and tidy, to remember all the bills and paper work and have them done on time, to lose weight and exercise, to be organised with birthdays, Christmas and other important dates and to use my free time wisely so that I may achieve my goals.Related posts:<ol><li><a
href='http://erisds.co.uk/general/2009-review-and-aims-final-part' rel='bookmark' title='Permanent Link: 2009 Review and Aims Final Part'>2009 Review and Aims Final Part</a> <small>Short, honest and to the point. The last 5 months...</small></li><li><a
href='http://erisds.co.uk/internet/ive-signed-up-to-project52' rel='bookmark' title='Permanent Link: I&#8217;ve signed up to Project52'>I&#8217;ve signed up to Project52</a> <small>I've just signed up to Project52. Originally intended as a...</small></li></ol>]]></description> <content:encoded><![CDATA[<p>My new years resolution this year is an all encompassing mantra for me to live by:</p><h2>Stay on top of the game.</h2><p>I have a horrible habit of letting things slide: the housework, the bills, my weight, my hobbies, my blog, birthdays, even Christmas. Unless I have plenty of what I call &#8220;brain space&#8221;, I find it very difficult to remember to do all the things that I have to do, and even if I remember them I find it even harder to find motivation. If it can be left until later, invariably it is and if it can be strategically ignored then all the better.</p><p>For 2010 I pledge to <strong>stay on top of the game</strong>.</p><p>To keep my house clean and tidy, to remember all the bills and paper work and have them done on time, to lose weight and exercise, to be organised with birthdays, Christmas and other important dates and to use my free time wisely so that I may achieve my goals.</p><p>I am not writing this here because I think people will want to read it. But so that it&#8217;s here for me as something tangible, as a reminder, and hopefully as a little kick up the bum when I start to slip.</p><h3>To all I wish you a Happy New Year and all the best for 2010.</h3><p>And if you did kindly take the time to read this, I&#8217;d love to hear any top tips for staying organised as well as what your New Year&#8217;s resolutions are in the comments!</p><p>Related posts:<ol><li><a
href='http://erisds.co.uk/general/2009-review-and-aims-final-part' rel='bookmark' title='Permanent Link: 2009 Review and Aims Final Part'>2009 Review and Aims Final Part</a> <small>Short, honest and to the point. The last 5 months...</small></li><li><a
href='http://erisds.co.uk/internet/ive-signed-up-to-project52' rel='bookmark' title='Permanent Link: I&#8217;ve signed up to Project52'>I&#8217;ve signed up to Project52</a> <small>I've just signed up to Project52. Originally intended as a...</small></li></ol></p>]]></content:encoded> <wfw:commentRss>http://erisds.co.uk/personal/stay-on-top-of-the-game/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>2009 Review and Aims Final Part</title><link>http://erisds.co.uk/general/2009-review-and-aims-final-part</link> <comments>http://erisds.co.uk/general/2009-review-and-aims-final-part#comments</comments> <pubDate>Thu, 31 Dec 2009 18:33:15 +0000</pubDate> <dc:creator>ErisDS</dc:creator> <category><![CDATA[General]]></category> <category><![CDATA[apple]]></category> <category><![CDATA[blog]]></category> <category><![CDATA[google]]></category> <category><![CDATA[google sync]]></category> <category><![CDATA[iPhone]]></category> <category><![CDATA[resolutions]]></category><guid isPermaLink="false">http://erisds.co.uk/?p=887</guid> <description><![CDATA[Short, honest and to the point. The last 5 months have been an epic fail for me in terms of my mid-year resolutions and personal goals. I'm not going to go back through them or explain the multitude of things that had to take priority this year. Suffice to say, I did not achieve what I intended and that needs to change.Related posts:<ol><li><a
href='http://erisds.co.uk/general/2009-review-and-aims-part-ii' rel='bookmark' title='Permanent Link: 2009 Review and Aims Part II'>2009 Review and Aims Part II</a> <small>On the first of June I published a summary of...</small></li><li><a
href='http://erisds.co.uk/technology/what-is-wrong-with-my-iphone' rel='bookmark' title='Permanent Link: What is WRONG with my iPhone?'>What is WRONG with my iPhone?</a> <small>I've already filed a report on the Apple website &...</small></li><li><a
href='http://erisds.co.uk/general/2009-review-and-aims' rel='bookmark' title='Permanent Link: 2009 Review and Aims'>2009 Review and Aims</a> <small>At the beginning of 2009 I had been in my...</small></li></ol>]]></description> <content:encoded><![CDATA[<h2>I&#8217;ve failed</h2><p>Short, honest and to the point. The last 5 months have been an epic fail for me in terms of my mid-year resolutions and personal goals. I&#8217;m not going to go back through them or explain the multitude of things that had to take priority this year. Suffice to say, I did not achieve what I intended and that needs to change.</p><h2>I&#8217;ve Succeeded</h2><p>2009 has not been a complete failure. In 12 months in our new home we have completely refitted the bathroom &amp; replaced leaky plumbing, had the entire house rewired, redecorated the lounge, almost finished redecorating &amp; updating the kitchen and organised for the windows and doors to be replaced as needed. I&#8217;ve also succeeded in my first year of employment, and to top it off after 5 years of engagement I have finally (finally) booked my wedding, huzzah!</p><h2>The Future</h2><p>This year I have published 24 articles, but I have 20 drafts sitting waiting to be given some TLC and a click on the publish button. There&#8217;s no point in updating goals I haven&#8217;t achieved yet, but I certainly need a plan of action if I&#8217;m going to succeed with this blog. To stop the house and wedding from taking over my life entirely in 2010, I am going to have to get organised.</p><p>I have a weapon up my sleeve for this one: my shiny new iPhone. It pains me that I&#8217;m pinning my hopes on an Apple product, but such is life. I&#8217;ve organised all my contacts and events into <a
title="Google is God" href="http://www.google.co.uk" target="_blank">Google</a> <a
title="Google Mail" href="http://mail.google.com/" target="_blank">Mail </a>and <a
title="Google Calendar" href="http://www.google.com/calendar" target="_blank">Calendar</a> and am using <a
title="Google Sync Service" href="http://www.google.com/sync/index.html" target="_blank">Google Sync</a> to magically sync all that info with my iPhone. Now all I need is a ToDo list application that does the same syncing magic. I&#8217;m having to move away from my online favourite <a
title="Todoist" href="http://todoist.com" target="_blank">todoist</a> because none of the iPhone apps seem to work (I paid £2.99 to find that out!). I&#8217;m planning to try out Toodledo but any recommendations would be graciously received!</p><p>I&#8217;m also loving the Wordpress app for the iPhone. It is letting me regain those minutes wasted whilst dinner cooks or the kettle boils and use them towards getting one of those draft articles published. There&#8217;s plenty more to be said about the iPhone, but I&#8217;ll save that for another blog post.</p><p>So that&#8217;s it from me for 2009, it&#8217;s been a toughy. Here&#8217;s to an organised 2010 that&#8217;s rich in blog content!</p><p>Related posts:<ol><li><a
href='http://erisds.co.uk/general/2009-review-and-aims-part-ii' rel='bookmark' title='Permanent Link: 2009 Review and Aims Part II'>2009 Review and Aims Part II</a> <small>On the first of June I published a summary of...</small></li><li><a
href='http://erisds.co.uk/technology/what-is-wrong-with-my-iphone' rel='bookmark' title='Permanent Link: What is WRONG with my iPhone?'>What is WRONG with my iPhone?</a> <small>I've already filed a report on the Apple website &...</small></li><li><a
href='http://erisds.co.uk/general/2009-review-and-aims' rel='bookmark' title='Permanent Link: 2009 Review and Aims'>2009 Review and Aims</a> <small>At the beginning of 2009 I had been in my...</small></li></ol></p>]]></content:encoded> <wfw:commentRss>http://erisds.co.uk/general/2009-review-and-aims-final-part/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>It’s been a Very Quiet Month…</title><link>http://erisds.co.uk/general/its-been-a-very-quiet-month</link> <comments>http://erisds.co.uk/general/its-been-a-very-quiet-month#comments</comments> <pubDate>Wed, 16 Sep 2009 20:27:47 +0000</pubDate> <dc:creator>ErisDS</dc:creator> <category><![CDATA[General]]></category> <category><![CDATA[blog]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[review]]></category> <category><![CDATA[Symfony]]></category> <category><![CDATA[YUI]]></category><guid isPermaLink="false">http://erisds.co.uk/?p=827</guid> <description><![CDATA[It's now been over a month since my last post to this blog. I had promised not to ever let it get longer than 10 days but this past month has been an exceptional circumstance. I've had a few enquiries regarding part 3 of my YUI articles, so this post is just a quick update to say it's still on it's way!Related posts:<ol><li><a
href='http://erisds.co.uk/general/2009-review-and-aims-part-ii' rel='bookmark' title='Permanent Link: 2009 Review and Aims Part II'>2009 Review and Aims Part II</a> <small>On the first of June I published a summary of...</small></li><li><a
href='http://erisds.co.uk/general/2009-review-and-aims' rel='bookmark' title='Permanent Link: 2009 Review and Aims'>2009 Review and Aims</a> <small>At the beginning of 2009 I had been in my...</small></li><li><a
href='http://erisds.co.uk/code/yui-javascript-carousel-custom-navigation-part-1' rel='bookmark' title='Permanent Link: YUI: Javascript Carousel with Custom Navigation &#8211; Part 1'>YUI: Javascript Carousel with Custom Navigation &#8211; Part 1</a> <small>Welcome to my first JavaScript related post! I'm currently in...</small></li></ol>]]></description> <content:encoded><![CDATA[<p>It&#8217;s now been over a month since my last post to this blog. I had promised not to ever let it get longer than 10 days, but this past month has been an exceptional circumstance. I&#8217;ve had a few enquiries regarding part 3 of my YUI Carousel article series, so this post is just a quick update to say it&#8217;s still on it&#8217;s way!</p><p>As <a
href="http://erisds.co.uk/internet/my-web-hosting-nightmare">my last post explained</a>, I&#8217;ve had my house rewired and since redecorated. I had to pack my computer up in a box for 3 weeks (shock horror) whilst this was done, meaning I had little access to work on my blog articles. Since the redecorating has been finished I have had a lot of joint pain, and have now been diagnosed with Inflammatory Arthritis. This means that the amount of typing I can do in a day is governed by the pain in my hands :(</p><p>However I do have some bits of good news! Firstly, YUI Javascript Carousel Part 3 is in the works and should be published in a few days. Secondly, Part 3 was going to be the last article in the series but I now also have material for a fourth, and potentially a fifth article. Finally, I will shortly be receiving a copy of the forthcoming Symfony book &#8220;Symfony 1.3 Web Application Development&#8221; which I will reviewing along with some potential goodies!</p><p>In summary, there is plenty of good stuff in the works, but it&#8217;s unfortunately taking me longer to get it done. So please bare with me and keep watching this space!</p><p>Related posts:<ol><li><a
href='http://erisds.co.uk/general/2009-review-and-aims-part-ii' rel='bookmark' title='Permanent Link: 2009 Review and Aims Part II'>2009 Review and Aims Part II</a> <small>On the first of June I published a summary of...</small></li><li><a
href='http://erisds.co.uk/general/2009-review-and-aims' rel='bookmark' title='Permanent Link: 2009 Review and Aims'>2009 Review and Aims</a> <small>At the beginning of 2009 I had been in my...</small></li><li><a
href='http://erisds.co.uk/code/yui-javascript-carousel-custom-navigation-part-1' rel='bookmark' title='Permanent Link: YUI: Javascript Carousel with Custom Navigation &#8211; Part 1'>YUI: Javascript Carousel with Custom Navigation &#8211; Part 1</a> <small>Welcome to my first JavaScript related post! I'm currently in...</small></li></ol></p>]]></content:encoded> <wfw:commentRss>http://erisds.co.uk/general/its-been-a-very-quiet-month/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>My Web Hosting Nightmare…</title><link>http://erisds.co.uk/internet/my-web-hosting-nightmare</link> <comments>http://erisds.co.uk/internet/my-web-hosting-nightmare#comments</comments> <pubDate>Fri, 14 Aug 2009 21:05:56 +0000</pubDate> <dc:creator>ErisDS</dc:creator> <category><![CDATA[Internet]]></category> <category><![CDATA[blog]]></category> <category><![CDATA[hosting]]></category> <category><![CDATA[Wordpress]]></category><guid isPermaLink="false">http://erisds.co.uk/?p=797</guid> <description><![CDATA[This past week and a half I have "moved home" in more ways than one. Not only have I had to move EVERYTHING out of the house we bought 8 months ago so that electricians can re-wire the entire place, but I have also moved this blog to a new home with <a
href="http://hosting.peartreeuk.com/" target="_blank">PeartreeUK</a>. The result is I have been unbelievably busy, have no electricity at home (or sofa, or bed) and the 3rd part of my <a
href="http://erisds.co.uk/code/yui-javascript-carousel-custom-navigation-part-1" target="_blank">YUI: Javascript Carousel</a> series has been delayed.<h2>Web Hosting is a minefield...</h2> Seeing the web hosting feature in the latest edition of <a
href="http://www.netmag.co.uk/" target="_blank"><strong>.net Magazine</strong></a> has confirmed my feelings about the web hosting industry: it's a minefield. A completely over saturated market of small-fry &#38; big brands, most of which you will never have heard of unless you've heard a horror story or two. In my experience it doesn't seem to matter where you turn, something unexpected goes wrong...last weekend I  decided to finally sort out my hosting life. With all my resold accounts still hanging around on slowly-slowly-Surpass, and my blog on clunky-Clook, I've turned back to the one place I know I'll get what I pay for - <a
href="http://hosting.peartreeuk.com/" target="_blank">PearTreeUK</a>. They may be relatively small, but there's nothing like being able to get hold of an <strong>intelligent human being</strong> whenever you need one! Having kept my original account open as a test bed, I have now upgraded to a reseller with them.Related posts:<ol><li><a
href='http://erisds.co.uk/general/2009-review-and-aims-final-part' rel='bookmark' title='Permanent Link: 2009 Review and Aims Final Part'>2009 Review and Aims Final Part</a> <small>Short, honest and to the point. The last 5 months...</small></li><li><a
href='http://erisds.co.uk/wordpress/wordpress-2-8' rel='bookmark' title='Permanent Link: Wordpress 2.8'>Wordpress 2.8</a> <small>Over the weekend I updated my blog to Wordpress 2.8....</small></li><li><a
href='http://erisds.co.uk/general/2009-review-and-aims-part-ii' rel='bookmark' title='Permanent Link: 2009 Review and Aims Part II'>2009 Review and Aims Part II</a> <small>On the first of June I published a summary of...</small></li></ol>]]></description> <content:encoded><![CDATA[<p>This past week and a half I have &#8220;moved home&#8221; in more ways than one. Not only have I had to move EVERYTHING out of the house we bought 8 months ago so that electricians can re-wire the entire place, but I have also moved this blog to a new home with <a
href="http://hosting.peartreeuk.com/" target="_blank">PeartreeUK</a>. The result is I have been unbelievably busy, have no electricity at home (or sofa, or bed) and the 3rd part of my <a
href="http://erisds.co.uk/code/yui-javascript-carousel-custom-navigation-part-1" target="_blank">YUI: Javascript Carousel</a> series has been delayed.</p><h2>Web Hosting is a minefield&#8230;</h2><p>Seeing the web hosting feature in the latest edition of <a
href="http://www.netmag.co.uk/" target="_blank"><strong>.net Magazine</strong></a> has confirmed my feelings about the web hosting industry: it&#8217;s a minefield. A completely over saturated market of small-fry &amp; big brands, most of which you will never have heard of unless you&#8217;ve heard a horror story or two. In my experience it doesn&#8217;t seem to matter where you turn, something unexpected goes wrong.</p><p>For years I was a happy client of <strong>Lonex</strong>. Their support was good enough although there was no status page, the servers were reliable, and generally things went ok. Then they got <strong>DDoSed </strong>and never recovered &#8211; my sites suffered <strong>downtime</strong> a few times a week, everything was <strong>slow</strong>, and I couldn&#8217;t get support to acknowledge or fix the problem.</p><p>So I moved to <strong>Surpass</strong>: a seemingly huge company with a public community, status pages, good support, and reliable service. Then I started work on this blog and found the <strong>pages loaded really slowly</strong>. I queried this and after ages of back and forth with support I got a message which simply read: <em>&#8220;Thanks for your patience. We have completed some work on this server and performance is back to normal. Thanks for hanging in there.&#8221;</em> &#8211; Nothing had changed as far as I was concerned.</p><p>Next I opened a single account on <a
href="http://hosting.peartreeuk.com/">PeartreeUK</a> and started prepping my blog for launch. For some reason I couldn&#8217;t get <strong>Wordpress</strong> to work properly. In my frustration I gave up without giving them a chance and tried yet another company.</p><p>This time it was <strong>Clook</strong>. A more expensive company but they had good reviews from friends so I figured I&#8217;d get what I paid for. My blog had the same Wordpress problems  &amp; I realised it was entirely my fault. So I got it all fixed and launched my blog on<strong> Clook.</strong></p><p>4 months later and I have two niggles with <strong>Clook</strong>:</p><ol><li> Because Apache is running as &#8220;noone&#8221; PHP scripts create files that I can&#8217;t delete through FTP. There is no way to remove the files through the control panel so I have had to install a PHP File manager which I really don&#8217;t like. It just makes my life far more complicated than it needs to be, especially when trying to work with a publishing platform like <strong>Wordpress</strong>.</li><li>For some reason there is no way to setup recurring payments. I have to remember to pay my bill each month. Yet again just something dumb that makes my life harder than it needs to be.</li></ol><h2>PeartreeUK &#8211; my Web Hosting Solution</h2><p>So last weekend I  decided to finally sort out my hosting life. With all my resold accounts still hanging around on slowly-slowly-Surpass, and my blog on clunky-Clook, I&#8217;ve turned back to the one place I know I&#8217;ll get what I pay for &#8211; <a
href="http://hosting.peartreeuk.com/" target="_blank">PearTreeUK</a>. They may be relatively small, but there&#8217;s nothing like being able to get hold of an <strong>intelligent human being</strong> whenever you need one! Having kept my original account open as a test bed, I have now upgraded to a reseller with them.</p><p>I doubt you will find better customer service than <a
href="http://hosting.peartreeuk.com/" target="_blank">PeartreeUK&#8217;s</a> -  having one person consistently deal with you from day one means that you are always taken care of without the frustration of trying to explain yourself AGAIN everytime there&#8217;s a shift-change. If you&#8217;ve visited here before you may notice how much faster pages (and FTP) now loads &#8211; my Wordpress backend feels like it&#8217;s on speed. Add to that their prices &amp; the excellent attitude of their employees and you have a value-for-money service that I <strong>highly recommend</strong>.</p><p
class="small"><strong>Note:</strong> Expect an update post in 6 months documenting my experiences with Peartree!</p><p>Related posts:<ol><li><a
href='http://erisds.co.uk/general/2009-review-and-aims-final-part' rel='bookmark' title='Permanent Link: 2009 Review and Aims Final Part'>2009 Review and Aims Final Part</a> <small>Short, honest and to the point. The last 5 months...</small></li><li><a
href='http://erisds.co.uk/wordpress/wordpress-2-8' rel='bookmark' title='Permanent Link: Wordpress 2.8'>Wordpress 2.8</a> <small>Over the weekend I updated my blog to Wordpress 2.8....</small></li><li><a
href='http://erisds.co.uk/general/2009-review-and-aims-part-ii' rel='bookmark' title='Permanent Link: 2009 Review and Aims Part II'>2009 Review and Aims Part II</a> <small>On the first of June I published a summary of...</small></li></ol></p>]]></content:encoded> <wfw:commentRss>http://erisds.co.uk/internet/my-web-hosting-nightmare/feed</wfw:commentRss> <slash:comments>11</slash:comments> </item> <item><title>YUI: Javascript Carousel with Custom Navigation – Part 2</title><link>http://erisds.co.uk/code/yui-javascript-carousel-custom-navigation-part-2</link> <comments>http://erisds.co.uk/code/yui-javascript-carousel-custom-navigation-part-2#comments</comments> <pubDate>Tue, 04 Aug 2009 12:28:07 +0000</pubDate> <dc:creator>ErisDS</dc:creator> <category><![CDATA[Code]]></category> <category><![CDATA[css]]></category> <category><![CDATA[featured]]></category> <category><![CDATA[frameworks]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[web development]]></category> <category><![CDATA[widgets]]></category> <category><![CDATA[YUI]]></category><guid isPermaLink="false">http://erisds.co.uk/?p=692</guid> <description><![CDATA[<a
href="http://erisds.co.uk/resources/yui-carousel-demo-2"><img
src="http://erisds.co.uk/wp-content/uploads/2009/08/carousel-2.jpg" alt="YUI Carousel Example  2" title="YUI Carousel Example 2" width="350" height="257" class="alignleft size-full wp-image-749" /></a>Welcome to <strong>Part 2</strong> of my YUI Carousel series. If you haven't read it, <a
href="http://erisds.co.uk/code/yui-javscript-carousel-custom-navigation-part-1">Part 1 is here</a>. <strong>Part 2</strong> uses class names to setup multiple carousel instances, and also drops the YUI CSS in favour of writing your own custom css. The final <strong>Part 3</strong> will show you how to write your own completely custom navigation for the carousel.If you haven't already read the first part of this tutorial, I suggest that you do. If you want to follow along, then please setup your workspace with a basic HTML file and somewhere to put Javascript, CSS &#038; images now, <a
href="http://erisds.co.uk/resources/yui-carousel-demo-2">the demonstration page is here</a> . I'll be using the same images as last time, same rules apply!Related posts:<ol><li><a
href='http://erisds.co.uk/code/yui-javascript-carousel-custom-navigation-part-1' rel='bookmark' title='Permanent Link: YUI: Javascript Carousel with Custom Navigation &#8211; Part 1'>YUI: Javascript Carousel with Custom Navigation &#8211; Part 1</a> <small>Welcome to my first JavaScript related post! I'm currently in...</small></li><li><a
href='http://erisds.co.uk/symfony/symfony-what-is-it-good-for' rel='bookmark' title='Permanent Link: Symfony: What is it good for?'>Symfony: What is it good for?</a> <small>Symfony is one of my favourite bits of technology. I’ve...</small></li><li><a
href='http://erisds.co.uk/general/its-been-a-very-quiet-month' rel='bookmark' title='Permanent Link: It&#8217;s been a Very Quiet Month&#8230;'>It&#8217;s been a Very Quiet Month&#8230;</a> <small>It's now been over a month since my last post...</small></li></ol>]]></description> <content:encoded><![CDATA[<p><a
href="http://erisds.co.uk/resources/yui-carousel-demo-2"><img
src="http://erisds.co.uk/wp-content/uploads/2009/08/carousel-2.jpg" alt="YUI Carousel Example  2" title="YUI Carousel Example 2" width="350" height="257" class="alignleft size-full wp-image-749" /></a>Welcome to <strong>Part 2</strong> of my YUI Carousel series. This part uses class names to setup multiple carousel instances, and also drops the YUI CSS in favour of writing your own custom css. The final <strong>Part 3</strong> will show you how to ditch the YUI navigation completely, so that you can use custom labels.</p><p>I recommend that you read <a
href="http://erisds.co.uk/code/yui-javascript-carousel-custom-navigation-part-1"><strong>Part 1</strong></a> of this tutorial if you haven&#8217;t already. If you want to follow along, then please setup your workspace with a basic HTML file and somewhere to put Javascript, CSS &#038; images now, <a
href="http://erisds.co.uk/resources/yui-carousel-demo-2">the demonstration page is here</a>. I&#8217;ll be using the same images as last time, same rules apply!</p><h2>Getting Started &#8211; The HTML</h2><p>The HTML for the carousel is the same as in <a
href="http://erisds.co.uk/code/yui-javascript-carousel-custom-navigation-part-1">Part 1</a>, except this time I have added titles to my images. Below I&#8217;ve only listed one carousel, but as you can see on the <a
href="http://erisds.co.uk/resources/yui-carousel-demo-2">demonstration page</a>, the setup JavaScript we&#8217;ll be writing later will detect multiple carousels on the page. To add another carousel just copy the HTML structure including the container div, change the id&#8217;s but leave the classes intact.</p><div
class="codecolorer-container html4strict twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table
cellspacing="0" cellpadding="0"><tbody><tr><td
style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br
/>2<br
/>3<br
/>4<br
/>5<br
/>6<br
/>7<br
/>8<br
/>9<br
/>10<br
/>11<br
/>12<br
/>13<br
/>14<br
/>15<br
/>16<br
/>17<br
/>18<br
/></div></td><td><div
class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/body.html"><span
style="color: #000000; font-weight: bold;">body</span></a> <span
style="color: #000066;">class</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;carousel&quot;</span>&gt;</span><br
/> &nbsp; <span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/div.html"><span
style="color: #000000; font-weight: bold;">div</span></a> <span
style="color: #000066;">id</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;my-carousel&quot;</span> <span
style="color: #000066;">class</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;carousel-container&quot;</span>&gt;</span><br
/> &nbsp; &nbsp; <span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/ol.html"><span
style="color: #000000; font-weight: bold;">ol</span></a> <span
style="color: #000066;">class</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;carousel-content&quot;</span>&gt;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/li.html"><span
style="color: #000000; font-weight: bold;">li</span></a>&gt;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/img.html"><span
style="color: #000000; font-weight: bold;">img</span></a> <span
style="color: #000066;">src</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://farm3.static.flickr.com/2181/3529457733_50200b99ab.jpg&quot;</span> <span
style="color: #000066;">width</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;500&quot;</span> <span
style="color: #000066;">height</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;364&quot;</span> <span
style="color: #000066;">alt</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Baby Dolphin&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/h2.html"><span
style="color: #000000; font-weight: bold;">h2</span></a>&gt;</span>A Baby Dolphin called Bob<span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span><a
href="http://december.com/html/4/element/h2.html"><span
style="color: #000000; font-weight: bold;">h2</span></a>&gt;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span><a
href="http://december.com/html/4/element/li.html"><span
style="color: #000000; font-weight: bold;">li</span></a>&gt;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/li.html"><span
style="color: #000000; font-weight: bold;">li</span></a>&gt;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/img.html"><span
style="color: #000000; font-weight: bold;">img</span></a> <span
style="color: #000066;">src</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://farm4.static.flickr.com/3543/3514480796_2243d70d6b.jpg&quot;</span> <span
style="color: #000066;">width</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;500&quot;</span> <span
style="color: #000066;">height</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;364&quot;</span><span
style="color: #000066;">alt</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Birds&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/h2.html"><span
style="color: #000000; font-weight: bold;">h2</span></a>&gt;</span>Feeding the birds<span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span><a
href="http://december.com/html/4/element/h2.html"><span
style="color: #000000; font-weight: bold;">h2</span></a>&gt;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span><a
href="http://december.com/html/4/element/li.html"><span
style="color: #000000; font-weight: bold;">li</span></a>&gt;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/li.html"><span
style="color: #000000; font-weight: bold;">li</span></a>&gt;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/img.html"><span
style="color: #000000; font-weight: bold;">img</span></a> <span
style="color: #000066;">src</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://farm4.static.flickr.com/3306/3503294318_c34fab9d17.jpg&quot;</span> <span
style="color: #000066;">width</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;500&quot;</span> <span
style="color: #000066;">height</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;364&quot;</span> <span
style="color: #000066;">alt</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Tiger&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/h2.html"><span
style="color: #000000; font-weight: bold;">h2</span></a>&gt;</span>Up close and personal with a tiger<span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span><a
href="http://december.com/html/4/element/h2.html"><span
style="color: #000000; font-weight: bold;">h2</span></a>&gt;</span> &nbsp;<br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span><a
href="http://december.com/html/4/element/li.html"><span
style="color: #000000; font-weight: bold;">li</span></a>&gt;</span><br
/> &nbsp; &nbsp; <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span><a
href="http://december.com/html/4/element/ol.html"><span
style="color: #000000; font-weight: bold;">ol</span></a>&gt;</span><br
/> &nbsp; <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span><a
href="http://december.com/html/4/element/div.html"><span
style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span><a
href="http://december.com/html/4/element/body.html"><span
style="color: #000000; font-weight: bold;">body</span></a>&gt;</span></div></td></tr></tbody></table></div><h2>Referencing YUI</h2><p>You&#8217;ll need to add the same JavaScript references right above your closing body tag as last time. That is the link to the combined YUI scripts, plus your own setup JavaScript file. This time though, <strong>DON&#8217;T</strong> include the YUI CSS, just add a link to your own CSS file at the top of the page. So these are the includes you should have:</p><div
class="codecolorer-container html4strict twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table
cellspacing="0" cellpadding="0"><tbody><tr><td
style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br
/>2<br
/>3<br
/>4<br
/>5<br
/>6<br
/>7<br
/>8<br
/>9<br
/></div></td><td><div
class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/head.html"><span
style="color: #000000; font-weight: bold;">head</span></a>&gt;</span><br
/> &nbsp; <span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/link.html"><span
style="color: #000000; font-weight: bold;">link</span></a> <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: #000066;">href</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;css/carousel.css&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span><a
href="http://december.com/html/4/element/head.html"><span
style="color: #000000; font-weight: bold;">head</span></a>&gt;</span><br
/> <span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/body.html"><span
style="color: #000000; font-weight: bold;">body</span></a>&gt;</span><br
/> &nbsp; &nbsp; <span
style="color: #808080; font-style: italic;">&lt;!-- Content here --&gt;</span><br
/> <br
/> &nbsp; <span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/script.html"><span
style="color: #000000; font-weight: bold;">script</span></a> <span
style="color: #000066;">src</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://yui.yahooapis.com/combo?2.7.0/build/yahoo-dom-event/yahoo-dom-event.js&amp;amp;2.7.0/build/element/element-min.js&amp;amp;2.7.0/build/animation/animation-min.js&amp;amp;2.7.0/build/carousel/carousel-min.js&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;&lt;<span
style="color: #66cc66;">/</span><a
href="http://december.com/html/4/element/script.html"><span
style="color: #000000; font-weight: bold;">script</span></a>&gt;</span><br
/> &nbsp; <span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/script.html"><span
style="color: #000000; font-weight: bold;">script</span></a> <span
style="color: #000066;">src</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;js/carousel.js&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;&lt;<span
style="color: #66cc66;">/</span><a
href="http://december.com/html/4/element/script.html"><span
style="color: #000000; font-weight: bold;">script</span></a>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span><a
href="http://december.com/html/4/element/body.html"><span
style="color: #000000; font-weight: bold;">body</span></a>&gt;</span></div></td></tr></tbody></table></div><h2>Setting up &#8211; Javascript</h2><h3>Step 1 &#8211; Locate all carousel markup on the page</h3><p>The first step is the same as last time, to setup our namespace and object literal. We still need an <kbd>init</kbd> function, and inside it we use the <kbd>getElementsByClassName</kbd> function to populate our <kbd>carousels</kbd> property with an array of all the elements which have the class <kbd>carousel-container</kbd>. We then loop over carousels and call a <kbd>setup</kbd> function on each element.</p><div
class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table
cellspacing="0" cellpadding="0"><tbody><tr><td
style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br
/>2<br
/>3<br
/>4<br
/>5<br
/>6<br
/>7<br
/>8<br
/>9<br
/>10<br
/>11<br
/></div></td><td><div
class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">YAHOO.<span
style="color: #003366; font-weight: bold;">namespace</span><span
style="color: #009900;">&#40;</span><span
style="color: #3366CC;">&quot;ErisDS&quot;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> YAHOO.<span
style="color: #660066;">ErisDS</span>.<span
style="color: #660066;">Carousel</span> <span
style="color: #339933;">=</span> <span
style="color: #009900;">&#123;</span><br
/> &nbsp; carousels<span
style="color: #339933;">:</span> <span
style="color: #3366CC;">''</span><span
style="color: #339933;">,</span><br
/> &nbsp; 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><br
/> &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; <span
style="color: #000066; font-weight: bold;">this</span>.<span
style="color: #660066;">carousels</span> <span
style="color: #339933;">=</span> YAHOO.<span
style="color: #660066;">util</span>.<span
style="color: #660066;">Dom</span>.<span
style="color: #660066;">getElementsByClassName</span><span
style="color: #009900;">&#40;</span><span
style="color: #3366CC;">'carousel-container'</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <span
style="color: #000066; font-weight: bold;">for</span><span
style="color: #009900;">&#40;</span>i <span
style="color: #339933;">=</span> <span
style="color: #CC0000;">0</span><span
style="color: #339933;">;</span> i <span
style="color: #339933;">&lt;</span> <span
style="color: #000066; font-weight: bold;">this</span>.<span
style="color: #660066;">carousels</span>.<span
style="color: #660066;">length</span><span
style="color: #339933;">;</span> i<span
style="color: #339933;">++</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #000066; font-weight: bold;">this</span>.<span
style="color: #660066;">setup</span><span
style="color: #009900;">&#40;</span><span
style="color: #000066; font-weight: bold;">this</span>.<span
style="color: #660066;">carousels</span><span
style="color: #009900;">&#91;</span>i<span
style="color: #009900;">&#93;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <span
style="color: #009900;">&#125;</span><br
/> &nbsp; <span
style="color: #009900;">&#125;</span><span
style="color: #339933;">,</span> ...</div></td></tr></tbody></table></div><h3>Step 2 &#8211; Turn carousel markup into working carousels</h3><p>Now we need to write our <kbd>setup</kbd> function. It takes the element that is to be a carousel as an argument. The body of the function contains the same setup code as our original <kbd>init</kbd> function from <a
href="http://erisds.co.uk/code/yui-javascript-carousel-custom-navigation-part-1">Part 1</a>, where the settings are explained.</p><div
class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table
cellspacing="0" cellpadding="0"><tbody><tr><td
style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br
/>2<br
/>3<br
/>4<br
/>5<br
/>6<br
/>7<br
/>8<br
/>9<br
/>10<br
/>11<br
/>12<br
/>13<br
/>14<br
/>15<br
/></div></td><td><div
class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; setup<span
style="color: #339933;">:</span> <span
style="color: #003366; font-weight: bold;">function</span><span
style="color: #009900;">&#40;</span>carousel_el<span
style="color: #009900;">&#41;</span><br
/> &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; <span
style="color: #003366; font-weight: bold;">var</span> carousel <span
style="color: #339933;">=</span> <span
style="color: #003366; font-weight: bold;">new</span> YAHOO.<span
style="color: #660066;">widget</span>.<span
style="color: #660066;">Carousel</span><span
style="color: #009900;">&#40;</span>carousel_el<span
style="color: #339933;">,</span> <br
/> &nbsp; &nbsp; <span
style="color: #009900;">&#123;</span> <br
/> &nbsp; &nbsp; &nbsp; autoPlayInterval<span
style="color: #339933;">:</span> 5000<span
style="color: #339933;">,</span> <br
/> &nbsp; &nbsp; &nbsp; isCircular<span
style="color: #339933;">:</span> <span
style="color: #003366; font-weight: bold;">true</span><span
style="color: #339933;">,</span> <br
/> &nbsp; &nbsp; &nbsp; animation<span
style="color: #339933;">:</span> <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; speed<span
style="color: #339933;">:</span> 1.0<br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&#125;</span><span
style="color: #339933;">,</span> <br
/> &nbsp; &nbsp; &nbsp; numVisible<span
style="color: #339933;">:</span> 1<br
/> &nbsp; &nbsp; <span
style="color: #009900;">&#125;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span> <br
/> &nbsp; &nbsp; carousel.<span
style="color: #660066;">render</span><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; carousel.<span
style="color: #660066;">show</span><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span> &nbsp; <br
/> &nbsp; &nbsp; carousel.<span
style="color: #660066;">startAutoPlay</span><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div></p><p>Finally, don&#8217;t forget to call the function using <kbd>onDOMReady()</kbd>.</p><p></code></p><div
class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table
cellspacing="0" cellpadding="0"><tbody><tr><td
style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br
/>2<br
/>3<br
/>4<br
/>5<br
/></div></td><td><div
class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">YAHOO.<span
style="color: #660066;">util</span>.<span
style="color: #660066;">Event</span>.<span
style="color: #660066;">onDOMReady</span><span
style="color: #009900;">&#40;</span><br
/> &nbsp; <span
style="color: #003366; font-weight: bold;">function</span> <span
style="color: #009900;">&#40;</span>ev<span
style="color: #009900;">&#41;</span> <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; &nbsp; YAHOO.<span
style="color: #660066;">ErisDS</span>.<span
style="color: #660066;">Carousel</span>.<span
style="color: #660066;">init</span><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #009900;">&#125;</span><br
/> <span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span></div></td></tr></tbody></table></div><h2>Styling up - The Custom CSS</h2></p><p>This time we aren't going to use the YUI CSS at all, so we will need to do quite a bit of work ourselves. First up I'll show you the bare minimum needed to get the carousel working. Then we will go through styling the navigation, and finally the customisations to get it looking the same as the demo page.</p><h3>The Bare Minimum</h3><p>To get the carousel working horizontally, we need to get all the items to display side-by-side. We then need to hide all but the item that should be visible using <kbd>overflow:hidden</kbd>. We also need to clear margins and padding, but we don't need to set any width or height - the carousel will just resize to fit the largest element inside of it.</p><div
class="codecolorer-container css twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:300px;"><table
cellspacing="0" cellpadding="0"><tbody><tr><td
style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br
/>2<br
/>3<br
/>4<br
/>5<br
/>6<br
/>7<br
/>8<br
/>9<br
/>10<br
/>11<br
/>12<br
/>13<br
/>14<br
/>15<br
/>16<br
/>17<br
/>18<br
/>19<br
/>20<br
/>21<br
/>22<br
/>23<br
/>24<br
/></div></td><td><div
class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #6666ff;">.carousel</span> .carousel-container<span
style="color: #00AA00;">&#123;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">overflow</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">hidden</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">position</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">relative</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">margin</span><span
style="color: #00AA00;">:</span> <span
style="color: #cc66cc;">0</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #00AA00;">&#125;</span><br
/> <br
/> <span
style="color: #6666ff;">.carousel</span> ol.carousel-<span
style="color: #000000; font-weight: bold;">content</span><span
style="color: #00AA00;">&#123;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">position</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">relative</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">overflow</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">hidden</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">width</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">32000px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">padding</span><span
style="color: #00AA00;">:</span> <span
style="color: #cc66cc;">0</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">margin</span><span
style="color: #00AA00;">:</span> <span
style="color: #cc66cc;">0</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #00AA00;">&#125;</span><br
/> <br
/> <span
style="color: #6666ff;">.carousel</span> ol.carousel-<span
style="color: #000000; font-weight: bold;">content</span> li<span
style="color: #00AA00;">&#123;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">position</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">relative</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">margin</span><span
style="color: #00AA00;">:</span> <span
style="color: #cc66cc;">0</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">float</span><span
style="color: #00AA00;">:</span> <span
style="color: #000000; font-weight: bold;">left</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">overflow</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">hidden</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #00AA00;">*</span><span
style="color: #000000; font-weight: bold;">float</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">none</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #00AA00;">*</span><span
style="color: #000000; font-weight: bold;">display</span><span
style="color: #00AA00;">:</span> inline-<span
style="color: #993333;">block</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #00AA00;">*</span>zoom<span
style="color: #00AA00;">:</span> <span
style="color: #cc66cc;">1</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #00AA00;">*</span><span
style="color: #000000; font-weight: bold;">display</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">inline</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div><p><img
src="http://erisds.co.uk/wp-content/uploads/2009/08/carousel-plain.jpg" alt="Carousel Plain" title="Carousel Plain" width="300" height="330" class="alignright size-full wp-image-741" /></p><p>I can hear people all over the interweb screaming "nooooo!" at the IE hacks. Feel free to move these to <a
href="http://www.quirksmode.org/css/condcom.html">conditional comments</a>, but for the purpose of tutorials using hacks makes it easier to show what I'm doing! All that extra code (plus the <kbd>position:relative</kbd>'s) is used to get IE6 &#038; 7 to display the items side-by-side whilst still hiding all but the first item.</p><p>On the right you can see how the carousel looks with just this basic styling - pretty nasty! Time to get creative. I want to get rid of the text in the navigation, put the navigation at the bottom, and add some nicer buttons<strong>*</strong>.</p><h3>The Navigation</h3><p>Because I want to put the navigation at the bottom &#038; have my carousel be fixed size, I need to set <kbd>width</kbd> and <kbd>height</kbd> on <kbd>carousel-container</kbd> and on the content <kbd>li</kbd>. I'm also going to add a <kbd>border</kbd> to contain the carousel. The following is the extra CSS I added.</p><div
class="codecolorer-container css twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table
cellspacing="0" cellpadding="0"><tbody><tr><td
style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br
/>2<br
/>3<br
/>4<br
/>5<br
/>6<br
/>7<br
/>8<br
/>9<br
/>10<br
/></div></td><td><div
class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #6666ff;">.carousel</span> .carousel-container<span
style="color: #00AA00;">&#123;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">width</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">500px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">height</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">364px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">border</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">5px</span> <span
style="color: #cc00cc;">#451669</span> <span
style="color: #993333;">solid</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #00AA00;">&#125;</span><br
/> <br
/> <span
style="color: #6666ff;">.carousel</span> ol.carousel-<span
style="color: #000000; font-weight: bold;">content</span> li<span
style="color: #00AA00;">&#123;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">width</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">500px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">height</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">364px</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div><p>The following code uses <kbd>position:absolute</kbd> to move the navigation to the bottom. I've also added a semi-transparent background to the navigation bar, and used the <kbd>inline-block</kbd> hack again to get the <kbd>UL</kbd> to sit in the middle for all browsers. In the second part I have turned the navigation into circles using the CSS3 <kbd>border-radius</kbd> property (IE users will see squares) &#038; gotten rid of the text with positioning.</p><div
class="codecolorer-container css twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:300px;"><table
cellspacing="0" cellpadding="0"><tbody><tr><td
style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br
/>2<br
/>3<br
/>4<br
/>5<br
/>6<br
/>7<br
/>8<br
/>9<br
/>10<br
/>11<br
/>12<br
/>13<br
/>14<br
/>15<br
/>16<br
/>17<br
/>18<br
/>19<br
/>20<br
/>21<br
/>22<br
/>23<br
/>24<br
/>25<br
/>26<br
/>27<br
/>28<br
/>29<br
/>30<br
/>31<br
/>32<br
/>33<br
/>34<br
/>35<br
/>36<br
/>37<br
/>38<br
/>39<br
/>40<br
/>41<br
/>42<br
/>43<br
/>44<br
/>45<br
/></div></td><td><div
class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #6666ff;">.carousel</span> .yui-carousel-nav<span
style="color: #00AA00;">&#123;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">position</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">absolute</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">bottom</span><span
style="color: #00AA00;">:</span> <span
style="color: #cc66cc;">0</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">left</span><span
style="color: #00AA00;">:</span> <span
style="color: #cc66cc;">0</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">right</span><span
style="color: #00AA00;">:</span> <span
style="color: #cc66cc;">0</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">z-index</span><span
style="color: #00AA00;">:</span> <span
style="color: #cc66cc;">300</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">width</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">500px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">text-align</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">center</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">height</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">31px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">line-height</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">30px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">background</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">transparent</span> <span
style="color: #993333;">url</span><span
style="color: #00AA00;">&#40;</span><span
style="color: #ff0000;">'../images/bg.png'</span><span
style="color: #00AA00;">&#41;</span> <span
style="color: #000000; font-weight: bold;">top</span> <span
style="color: #000000; font-weight: bold;">left</span> <span
style="color: #993333;">repeat</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #00AA00;">&#125;</span><br
/> <br
/> <span
style="color: #6666ff;">.carousel</span> <span
style="color: #6666ff;">.yui-carousel-nav</span> ul<span
style="color: #00AA00;">&#123;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">margin</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">5px</span> <span
style="color: #cc66cc;">0</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">padding</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">0px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">display</span><span
style="color: #00AA00;">:</span> inline-<span
style="color: #993333;">block</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #00AA00;">*</span><span
style="color: #000000; font-weight: bold;">display</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">inline</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; zoom<span
style="color: #00AA00;">:</span> <span
style="color: #cc66cc;">1</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">vertical-align</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">middle</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">list-style</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">none</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #00AA00;">&#125;</span><br
/> <br
/> <span
style="color: #6666ff;">.carousel</span> <span
style="color: #6666ff;">.yui-carousel-nav</span> ul li<span
style="color: #00AA00;">&#123;</span> &nbsp;<br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">float</span><span
style="color: #00AA00;">:</span> <span
style="color: #000000; font-weight: bold;">left</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">height</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">8px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">width</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">8px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">background</span><span
style="color: #00AA00;">:</span> <span
style="color: #cc00cc;">#673191</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">margin</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">5px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">border</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">1px</span> <span
style="color: #993333;">solid</span> <span
style="color: #cc00cc;">#673191</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; -moz-border-radius<span
style="color: #00AA00;">:</span> <span
style="color: #933;">5px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">cursor</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">pointer</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #00AA00;">&#125;</span><br
/> <br
/> <span
style="color: #6666ff;">.carousel</span> <span
style="color: #6666ff;">.yui-carousel-nav</span> ul li a<span
style="color: #00AA00;">&#123;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">left</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">-10000px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">position</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">absolute</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #00AA00;">&#125;</span><br
/> <br
/> <span
style="color: #6666ff;">.carousel</span> <span
style="color: #6666ff;">.yui-carousel-nav</span> ul li<span
style="color: #3333ff;">:hover</span><span
style="color: #00AA00;">,</span> <br
/> <span
style="color: #6666ff;">.carousel</span> <span
style="color: #6666ff;">.yui-carousel-nav</span> ul li<span
style="color: #6666ff;">.hover</span><span
style="color: #00AA00;">,</span> <br
/> <span
style="color: #6666ff;">.carousel</span> <span
style="color: #6666ff;">.yui-carousel-nav</span> ul li<span
style="color: #6666ff;">.yui-carousel-nav-page-selected</span> <span
style="color: #00AA00;">&#123;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">background</span><span
style="color: #00AA00;">:</span> <span
style="color: #cc00cc;">#b6a2c4</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">cursor</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">pointer</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div><p>Next let's replace those ugly buttons with something else. By setting the <kbd>width</kbd>, <kbd>height</kbd> and <kbd>padding</kbd> of the <kbd>button</kbd> we can hide it. Then I've added a background image to the <kbd>span</kbd>s and absolutely positioned them. I have also been adding hover states to all the navigation, but at the moment these will only work in browsers that support the <kbd>:hover</kbd> psuedo class on elements other than the <kbd>anchor</kbd> tag.</p><div
class="codecolorer-container css twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:300px;"><table
cellspacing="0" cellpadding="0"><tbody><tr><td
style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br
/>2<br
/>3<br
/>4<br
/>5<br
/>6<br
/>7<br
/>8<br
/>9<br
/>10<br
/>11<br
/>12<br
/>13<br
/>14<br
/>15<br
/>16<br
/>17<br
/>18<br
/>19<br
/>20<br
/>21<br
/>22<br
/>23<br
/>24<br
/>25<br
/>26<br
/>27<br
/>28<br
/>29<br
/>30<br
/>31<br
/>32<br
/>33<br
/>34<br
/>35<br
/></div></td><td><div
class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #6666ff;">.carousel</span> <span
style="color: #6666ff;">.yui-carousel-nav</span> span<span
style="color: #00AA00;">&#123;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">position</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">absolute</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">bottom</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">3px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">width</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">25px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">height</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">25px</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #00AA00;">&#125;</span><br
/> <br
/> <span
style="color: #6666ff;">.carousel</span> <span
style="color: #6666ff;">.yui-carousel-nav</span> span button<span
style="color: #00AA00;">,</span> <span
style="color: #cc00cc;">#carousel-2</span> <span
style="color: #6666ff;">.yui-carousel-nav</span> span button<span
style="color: #3333ff;">:focus</span><span
style="color: #00AA00;">&#123;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">background</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">transparent</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">border</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">none</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">padding</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">30px</span> 0 <span
style="color: #cc66cc;">0</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">width</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">25px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">height</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">25px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">cursor</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">pointer</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #00AA00;">&#125;</span><br
/> <br
/> <span
style="color: #6666ff;">.carousel</span> <span
style="color: #6666ff;">.yui-carousel-nav</span> span.yui-carousel-first-button<span
style="color: #00AA00;">&#123;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">left</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">170px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">background</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">url</span><span
style="color: #00AA00;">&#40;</span><span
style="color: #ff0000;">'../images/prev-arrow.gif'</span><span
style="color: #00AA00;">&#41;</span> <span
style="color: #993333;">no-repeat</span> <span
style="color: #000000; font-weight: bold;">top</span> <span
style="color: #000000; font-weight: bold;">left</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #00AA00;">&#125;</span><br
/> <br
/> <span
style="color: #6666ff;">.carousel</span> <span
style="color: #6666ff;">.yui-carousel-nav</span> span.yui-carousel-next-button<span
style="color: #00AA00;">&#123;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">right</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">170px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">background</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">url</span><span
style="color: #00AA00;">&#40;</span><span
style="color: #ff0000;">'../images/next-arrow.gif'</span><span
style="color: #00AA00;">&#41;</span> <span
style="color: #993333;">no-repeat</span> <span
style="color: #000000; font-weight: bold;">top</span> <span
style="color: #000000; font-weight: bold;">left</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #00AA00;">&#125;</span><br
/> <br
/> <span
style="color: #6666ff;">.carousel</span> <span
style="color: #6666ff;">.yui-carousel-nav</span> span<span
style="color: #6666ff;">.yui-carousel-first-button</span><span
style="color: #3333ff;">:hover</span><span
style="color: #00AA00;">,</span><br
/> <span
style="color: #6666ff;">.carousel</span> <span
style="color: #6666ff;">.yui-carousel-nav</span> span.prev-hover<span
style="color: #00AA00;">&#123;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">background</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">url</span><span
style="color: #00AA00;">&#40;</span><span
style="color: #ff0000;">'../images/prev-arrow-hover.gif'</span><span
style="color: #00AA00;">&#41;</span> <span
style="color: #993333;">no-repeat</span> <span
style="color: #000000; font-weight: bold;">top</span> <span
style="color: #000000; font-weight: bold;">left</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #00AA00;">&#125;</span><br
/> <br
/> <span
style="color: #6666ff;">.carousel</span> <span
style="color: #6666ff;">.yui-carousel-nav</span> span<span
style="color: #6666ff;">.yui-carousel-next-button</span><span
style="color: #3333ff;">:hover</span><span
style="color: #00AA00;">,</span><br
/> <span
style="color: #6666ff;">.carousel</span> <span
style="color: #6666ff;">.yui-carousel-nav</span> span.next-hover<span
style="color: #00AA00;">&#123;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">background</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">url</span><span
style="color: #00AA00;">&#40;</span><span
style="color: #ff0000;">'../images/next-arrow-hover.gif'</span><span
style="color: #00AA00;">&#41;</span> <span
style="color: #993333;">no-repeat</span> <span
style="color: #000000; font-weight: bold;">top</span> <span
style="color: #000000; font-weight: bold;">left</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div><p>We can fix the hover states for the previous and next buttons with some Javascript, but I haven't found a way to get this to work for the list navigation yet as it gets rewritten everytime the carousel changes and therefore it loses the listeners. To add listeners to the buttons, first add the following code to the end of your <kbd>init</kbd> function.</p><div
class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table
cellspacing="0" cellpadding="0"><tbody><tr><td
style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br
/>2<br
/>3<br
/></div></td><td><div
class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; <span
style="color: #003366; font-weight: bold;">var</span> nav_buttons <span
style="color: #339933;">=</span> YAHOO.<span
style="color: #660066;">util</span>.<span
style="color: #660066;">Dom</span>.<span
style="color: #660066;">getElementsByClassName</span><span
style="color: #009900;">&#40;</span><span
style="color: #3366CC;">'yui-carousel-button'</span><span
style="color: #339933;">,</span><span
style="color: #3366CC;">'span'</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; YAHOO.<span
style="color: #660066;">util</span>.<span
style="color: #660066;">Event</span>.<span
style="color: #660066;">addListener</span><span
style="color: #009900;">&#40;</span>nav_buttons<span
style="color: #339933;">,</span><span
style="color: #3366CC;">'mouseover'</span><span
style="color: #339933;">,</span><span
style="color: #000066; font-weight: bold;">this</span>.<span
style="color: #660066;">mouseover</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; YAHOO.<span
style="color: #660066;">util</span>.<span
style="color: #660066;">Event</span>.<span
style="color: #660066;">addListener</span><span
style="color: #009900;">&#40;</span>nav_buttons<span
style="color: #339933;">,</span><span
style="color: #3366CC;">'mouseout'</span><span
style="color: #339933;">,</span><span
style="color: #000066; font-weight: bold;">this</span>.<span
style="color: #660066;">mouseout</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span></div></td></tr></tbody></table></div><p>Next, after the setup function add a comma, and then add the following two functions. All this does is add a <kbd>class</kbd> on mouseover and then remove it on mouseout, we use two different classes to make it easier to reference the buttons in IE6. This could be replaced with a sprite image &#038; CSS that just changes the background position.</p><div
class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:300px;"><table
cellspacing="0" cellpadding="0"><tbody><tr><td
style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br
/>2<br
/>3<br
/>4<br
/>5<br
/>6<br
/>7<br
/>8<br
/>9<br
/>10<br
/>11<br
/>12<br
/>13<br
/>14<br
/>15<br
/>16<br
/>17<br
/>18<br
/>19<br
/>20<br
/>21<br
/>22<br
/>23<br
/>24<br
/>25<br
/>26<br
/>27<br
/>28<br
/></div></td><td><div
class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; mouseover<span
style="color: #339933;">:</span> <span
style="color: #003366; font-weight: bold;">function</span><span
style="color: #009900;">&#40;</span>e<span
style="color: #009900;">&#41;</span><br
/> &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; <br
/> &nbsp; &nbsp; <span
style="color: #003366; font-weight: bold;">var</span> add_target <span
style="color: #339933;">=</span> YAHOO.<span
style="color: #660066;">util</span>.<span
style="color: #660066;">Event</span>.<span
style="color: #660066;">getTarget</span><span
style="color: #009900;">&#40;</span>e<span
style="color: #339933;">,</span> <span
style="color: #003366; font-weight: bold;">false</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #006600; font-style: italic;">//add_target = YAHOO.util.Dom.getAncestorByTagName(target,'span');</span><br
/> &nbsp; &nbsp; <span
style="color: #000066; font-weight: bold;">if</span><span
style="color: #009900;">&#40;</span>YAHOO.<span
style="color: #660066;">util</span>.<span
style="color: #660066;">Dom</span>.<span
style="color: #660066;">hasClass</span><span
style="color: #009900;">&#40;</span>add_target<span
style="color: #339933;">,</span> <span
style="color: #3366CC;">'yui-carousel-next-button'</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; &nbsp; YAHOO.<span
style="color: #660066;">util</span>.<span
style="color: #660066;">Dom</span>.<span
style="color: #660066;">addClass</span><span
style="color: #009900;">&#40;</span>add_target<span
style="color: #339933;">,</span> <span
style="color: #3366CC;">'next-hover'</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <span
style="color: #009900;">&#125;</span> <br
/> &nbsp; &nbsp; <span
style="color: #000066; font-weight: bold;">else</span> <span
style="color: #000066; font-weight: bold;">if</span><span
style="color: #009900;">&#40;</span>YAHOO.<span
style="color: #660066;">util</span>.<span
style="color: #660066;">Dom</span>.<span
style="color: #660066;">hasClass</span><span
style="color: #009900;">&#40;</span>add_target<span
style="color: #339933;">,</span> <span
style="color: #3366CC;">'yui-carousel-first-button'</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; &nbsp; YAHOO.<span
style="color: #660066;">util</span>.<span
style="color: #660066;">Dom</span>.<span
style="color: #660066;">addClass</span><span
style="color: #009900;">&#40;</span>add_target<span
style="color: #339933;">,</span> <span
style="color: #3366CC;">'prev-hover'</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <span
style="color: #009900;">&#125;</span> <br
/> &nbsp; <span
style="color: #009900;">&#125;</span><span
style="color: #339933;">,</span><br
/> &nbsp; mouseout<span
style="color: #339933;">:</span> <span
style="color: #003366; font-weight: bold;">function</span><span
style="color: #009900;">&#40;</span>e<span
style="color: #009900;">&#41;</span><br
/> &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; <span
style="color: #003366; font-weight: bold;">var</span> rem_target <span
style="color: #339933;">=</span> YAHOO.<span
style="color: #660066;">util</span>.<span
style="color: #660066;">Event</span>.<span
style="color: #660066;">getTarget</span><span
style="color: #009900;">&#40;</span>e<span
style="color: #339933;">,</span> <span
style="color: #003366; font-weight: bold;">false</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <span
style="color: #006600; font-style: italic;">//rem_target = YAHOO.util.Dom.getAncestorByTagName(target,'span');</span><br
/> &nbsp; &nbsp; <span
style="color: #000066; font-weight: bold;">if</span><span
style="color: #009900;">&#40;</span>YAHOO.<span
style="color: #660066;">util</span>.<span
style="color: #660066;">Dom</span>.<span
style="color: #660066;">hasClass</span><span
style="color: #009900;">&#40;</span>rem_target<span
style="color: #339933;">,</span> <span
style="color: #3366CC;">'next-hover'</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; &nbsp; YAHOO.<span
style="color: #660066;">util</span>.<span
style="color: #660066;">Dom</span>.<span
style="color: #660066;">removeClass</span><span
style="color: #009900;">&#40;</span>rem_target<span
style="color: #339933;">,</span> <span
style="color: #3366CC;">'next-hover'</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <span
style="color: #009900;">&#125;</span> <br
/> &nbsp; &nbsp; <span
style="color: #000066; font-weight: bold;">else</span> <span
style="color: #000066; font-weight: bold;">if</span><span
style="color: #009900;">&#40;</span>YAHOO.<span
style="color: #660066;">util</span>.<span
style="color: #660066;">Dom</span>.<span
style="color: #660066;">hasClass</span><span
style="color: #009900;">&#40;</span>rem_target<span
style="color: #339933;">,</span> <span
style="color: #3366CC;">'prev-hover'</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span> <br
/> &nbsp; &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; &nbsp; YAHOO.<span
style="color: #660066;">util</span>.<span
style="color: #660066;">Dom</span>.<span
style="color: #660066;">removeClass</span><span
style="color: #009900;">&#40;</span>rem_target<span
style="color: #339933;">,</span> <span
style="color: #3366CC;">&quot;prev-hover&quot;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <span
style="color: #009900;">&#125;</span><br
/> &nbsp; <span
style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div><h3>Headings</h3><p>That's it for the functionaliy. Here's the CSS I used to style my main heading. It's almost identical to the nav-bar code.</p><div
class="codecolorer-container css twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table
cellspacing="0" cellpadding="0"><tbody><tr><td
style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br
/>2<br
/>3<br
/>4<br
/>5<br
/>6<br
/>7<br
/>8<br
/>9<br
/>10<br
/>11<br
/>12<br
/>13<br
/>14<br
/></div></td><td><div
class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #6666ff;">.carousel</span> ol.carousel-<span
style="color: #000000; font-weight: bold;">content</span> li h2<span
style="color: #00AA00;">&#123;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">position</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">absolute</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">top</span><span
style="color: #00AA00;">:</span> <span
style="color: #cc66cc;">0</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">left</span><span
style="color: #00AA00;">:</span> <span
style="color: #cc66cc;">0</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">right</span><span
style="color: #00AA00;">:</span> <span
style="color: #cc66cc;">0</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">width</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">500px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">z-index</span><span
style="color: #00AA00;">:</span> <span
style="color: #cc66cc;">300</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">line-height</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">28px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">background</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">transparent</span> <span
style="color: #993333;">url</span><span
style="color: #00AA00;">&#40;</span><span
style="color: #ff0000;">'../images/bg.png'</span><span
style="color: #00AA00;">&#41;</span> <span
style="color: #000000; font-weight: bold;">top</span> <span
style="color: #000000; font-weight: bold;">left</span> <span
style="color: #993333;">repeat</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">color</span><span
style="color: #00AA00;">:</span> <span
style="color: #cc00cc;">#fff</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">margin</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">0px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">padding</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">5px</span><span
style="color: #00AA00;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">text-align</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">center</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div><p><a
href="http://erisds.co.uk/resources/yui-carousel-demo-2">On the demo page</a>, the two carousels are the same size and styled very similarly. However this is not necessary as you do not need to specifiy the size (the carousel will default to the size of the largest item within it) and you can also use <kbd>id</kbd>'s to style the two carousels entirely differently in the CSS, yet still use the same Javascript to make them work. However the functionality for the two carousels would remain the same.</p><p>Well I think that's a wrap!  Not every single bit of CSS I used is here, but I will be providing all my files which I publish <strong>Part 3</strong> next week some time. Hope you've found this useful &#038; reasonably easy to follow. Please drop any suggestions or ideas in the comments!</p><p
class="small"><strong>*</strong> I said nicer, not amazing... I'm no designer!!</p><h3>Resources</h3><ul><li><a
href="http://developer.yahoo.com/yui/docs/YAHOO.widget.Carousel.html">Visit the API for a full list of available methods, properties and attributes.</a></li><li><a
title="YUI Dependency Configurator" href="http://developer.yahoo.com/yui/articles/hosting/">YUI Dependency Configurator</a></li><li><a
href="http://erisds.co.uk/resources/yui-carousel-demo-2">The demo page (2)</a></li></ul><p>Related posts:<ol><li><a
href='http://erisds.co.uk/code/yui-javascript-carousel-custom-navigation-part-1' rel='bookmark' title='Permanent Link: YUI: Javascript Carousel with Custom Navigation &#8211; Part 1'>YUI: Javascript Carousel with Custom Navigation &#8211; Part 1</a> <small>Welcome to my first JavaScript related post! I'm currently in...</small></li><li><a
href='http://erisds.co.uk/symfony/symfony-what-is-it-good-for' rel='bookmark' title='Permanent Link: Symfony: What is it good for?'>Symfony: What is it good for?</a> <small>Symfony is one of my favourite bits of technology. I’ve...</small></li><li><a
href='http://erisds.co.uk/general/its-been-a-very-quiet-month' rel='bookmark' title='Permanent Link: It&#8217;s been a Very Quiet Month&#8230;'>It&#8217;s been a Very Quiet Month&#8230;</a> <small>It's now been over a month since my last post...</small></li></ol></p>]]></content:encoded> <wfw:commentRss>http://erisds.co.uk/code/yui-javascript-carousel-custom-navigation-part-2/feed</wfw:commentRss> <slash:comments>20</slash:comments> </item> <item><title>YUI: Javascript Carousel with Custom Navigation – Part 1</title><link>http://erisds.co.uk/code/yui-javascript-carousel-custom-navigation-part-1</link> <comments>http://erisds.co.uk/code/yui-javascript-carousel-custom-navigation-part-1#comments</comments> <pubDate>Tue, 28 Jul 2009 12:22:50 +0000</pubDate> <dc:creator>ErisDS</dc:creator> <category><![CDATA[Code]]></category> <category><![CDATA[css]]></category> <category><![CDATA[frameworks]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[web development]]></category> <category><![CDATA[widgets]]></category> <category><![CDATA[YUI]]></category><guid isPermaLink="false">http://erisds.co.uk/?p=501</guid> <description><![CDATA[<a
href="http://erisds.co.uk/resources/yui-carousel-demo-i"><img
class="alignleft size-full wp-image-675" title="Carousel 1" src="http://erisds.co.uk/wp-content/uploads/2009/07/carousel.jpg" alt="Carousel 1" width="350" height="254" /></a>Welcome to my first JavaScript related post! I'm currently in the process of both learning *proper* JavaScript and trying to get to grips with the YUI framework. If you have suggestions for how to improve the following code I'd love to hear them.The YUI Carousel widget is currently in Beta, and the navigation that it generates is very basic and, unlike the rest of the YUI framework, doesn't have the necessary CSS hooks to style it properly. This may change with the release of YUI 3.0, but the Carousel widget isn't included yet. So for the time being this <strong>three-part series</strong> will show you how to setup a Carousel &#38; build custom navigation.Related posts:<ol><li><a
href='http://erisds.co.uk/code/yui-javascript-carousel-custom-navigation-part-2' rel='bookmark' title='Permanent Link: YUI: Javascript Carousel with Custom Navigation &#8211; Part 2'>YUI: Javascript Carousel with Custom Navigation &#8211; Part 2</a> <small>Welcome to Part 2 of my YUI Carousel series. If...</small></li><li><a
href='http://erisds.co.uk/symfony/symfony-what-is-it-good-for' rel='bookmark' title='Permanent Link: Symfony: What is it good for?'>Symfony: What is it good for?</a> <small>Symfony is one of my favourite bits of technology. I’ve...</small></li><li><a
href='http://erisds.co.uk/general/its-been-a-very-quiet-month' rel='bookmark' title='Permanent Link: It&#8217;s been a Very Quiet Month&#8230;'>It&#8217;s been a Very Quiet Month&#8230;</a> <small>It's now been over a month since my last post...</small></li></ol>]]></description> <content:encoded><![CDATA[<p><a
href="http://erisds.co.uk/resources/yui-carousel-demo-1"><img
class="alignleft size-full wp-image-675" title="Carousel 1" src="http://erisds.co.uk/wp-content/uploads/2009/07/carousel.jpg" alt="Carousel 1" width="350" height="254" /></a>Welcome to my first JavaScript related post! I&#8217;m currently in the process of both learning *proper* JavaScript and trying to get to grips with the YUI framework. If you have suggestions for how to improve the following code I&#8217;d love to hear them.</p><p>The YUI Carousel widget is currently in Beta, and the navigation that it generates is very basic and, unlike the rest of the YUI framework, doesn&#8217;t have the necessary CSS hooks to style it properly. This may change with the release of YUI 3.0, but the Carousel widget isn&#8217;t included yet. So for the time being this <strong>three-part series</strong> will show you how to setup a Carousel &amp; build custom navigation.</p><p><strong>Part 1</strong> will go through the HTML, CSS &amp; Javascript needed to setup a basic carousel using the YUI default skin. In <strong><a
href="http://erisds.co.uk/code/yui-javascript-carousel-custom-navigation-part-2">Part 2</a></strong> we&#8217;ll remove the YUI skin and write our own, introduce multiple instances via class names and do some customisation to the carousel. Finally, in <strong>Part 3</strong> I&#8217;ll go through all of the Javascript needed to write your own, completely custom navigation for the carousel.</p><h2>Getting Started &#8211; The HTML</h2><p>If you want to follow along, then setup your workspace with a basic HTML file and somewhere to put Javascript, CSS &amp; images now. I&#8217;ll be using some photos from my recent holiday, feel free to use these images for testing purposes, but please don&#8217;t publish them as your own work! If you want to see the finished carousel in action, then please check out <a
href="http://erisds.co.uk/resources/yui-carousel-demo-1">the demonstration page</a>.</p><p>First we need to create the HTML list &amp; containers for our carousel along with some CSS classes for both reference and styling. This should include a container <kbd>&lt;div&gt;</kbd> (with class <kbd>carousel-container</kbd>) and an ordered list to contain our carousel items (class <kbd>carousel-content</kbd>). I have also added the classes <kbd>yui-skin-sam</kbd> and <kbd>carousel</kbd> to the body tag. Apart from those prefixed with &#8220;yui&#8221; all the classes I&#8217;m using are my own conventions and are not required by YUI.</p><div
class="codecolorer-container html4strict twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table
cellspacing="0" cellpadding="0"><tbody><tr><td
style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br
/>2<br
/>3<br
/>4<br
/>5<br
/>6<br
/>7<br
/>8<br
/>9<br
/></div></td><td><div
class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/body.html"><span
style="color: #000000; font-weight: bold;">body</span></a> <span
style="color: #000066;">class</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;yui-skin-sam carousel&quot;</span>&gt;</span><br
/> &nbsp; <span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/div.html"><span
style="color: #000000; font-weight: bold;">div</span></a> <span
style="color: #000066;">id</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;my-carousel&quot;</span> <span
style="color: #000066;">class</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;carousel-container&quot;</span>&gt;</span><br
/> &nbsp; &nbsp; <span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/ol.html"><span
style="color: #000000; font-weight: bold;">ol</span></a> <span
style="color: #000066;">class</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;carousel-content&quot;</span>&gt;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/li.html"><span
style="color: #000000; font-weight: bold;">li</span></a>&gt;&lt;<a
href="http://december.com/html/4/element/img.html"><span
style="color: #000000; font-weight: bold;">img</span></a> <span
style="color: #000066;">src</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://farm4.static.flickr.com/3543/3514480796_2243d70d6b.jpg&quot;</span> <span
style="color: #000066;">alt</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Birds&quot;</span> <span
style="color: #000066;">width</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;500&quot;</span> <span
style="color: #000066;">height</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;364&quot;</span> <span
style="color: #66cc66;">/</span>&gt;&lt;<span
style="color: #66cc66;">/</span><a
href="http://december.com/html/4/element/li.html"><span
style="color: #000000; font-weight: bold;">li</span></a>&gt;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/li.html"><span
style="color: #000000; font-weight: bold;">li</span></a>&gt;&lt;<a
href="http://december.com/html/4/element/img.html"><span
style="color: #000000; font-weight: bold;">img</span></a> <span
style="color: #000066;">src</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://farm4.static.flickr.com/3306/3503294318_c34fab9d17.jpg&quot;</span> <span
style="color: #000066;">alt</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Tiger&quot;</span> <span
style="color: #000066;">width</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;500&quot;</span> <span
style="color: #000066;">height</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;364&quot;</span> <span
style="color: #66cc66;">/</span>&gt;&lt;<span
style="color: #66cc66;">/</span><a
href="http://december.com/html/4/element/li.html"><span
style="color: #000000; font-weight: bold;">li</span></a>&gt;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/li.html"><span
style="color: #000000; font-weight: bold;">li</span></a>&gt;&lt;<a
href="http://december.com/html/4/element/img.html"><span
style="color: #000000; font-weight: bold;">img</span></a> <span
style="color: #000066;">src</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://farm4.static.flickr.com/3583/3530272148_4902b92aee.jpg&quot;</span> <span
style="color: #000066;">alt</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;zebra&quot;</span> <span
style="color: #000066;">width</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;500&quot;</span> <span
style="color: #000066;">height</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;364&quot;</span> <span
style="color: #66cc66;">/</span>&gt;&lt;<span
style="color: #66cc66;">/</span><a
href="http://december.com/html/4/element/li.html"><span
style="color: #000000; font-weight: bold;">li</span></a>&gt;</span><br
/> &nbsp; &nbsp; <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span><a
href="http://december.com/html/4/element/ol.html"><span
style="color: #000000; font-weight: bold;">ol</span></a>&gt;</span><br
/> &nbsp; <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span><a
href="http://december.com/html/4/element/div.html"><span
style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span><a
href="http://december.com/html/4/element/body.html"><span
style="color: #000000; font-weight: bold;">body</span></a>&gt;</span></div></td></tr></tbody></table></div><p>The <kbd>yui-skin-sam</kbd> class is a reference point for the YUI CSS so that the styling can be applied. For now I have added just three items to the list, and each one contains only an image. You can also include headers, paragraphs and any other HTML content to your carousel.</p><h2>Referencing YUI</h2><p>To turn our numbered list of images into a carousel we need to include reference to the YUI CSS and Javascript. Unlike many other frameworks, rather than downloading a local copy of the framework, it is normal to reference YUI direct from the Yahoo! Servers using the <a
title="YUI Dependency Configurator" href="http://developer.yahoo.com/yui/articles/hosting/">YUI Dependency Configurator</a> to work out which files you need. For now I will show you which files to add:</p><p>We are going to need the carousel.css file to style the list properly. Add the following stylesheet link to the head of your HTML file.</p><div
class="codecolorer-container html4strict twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table
cellspacing="0" cellpadding="0"><tbody><tr><td
style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br
/></div></td><td><div
class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/link.html"><span
style="color: #000000; font-weight: bold;">link</span></a> <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: #000066;">href</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://yui.yahooapis.com/combo?2.7.0/build/carousel/assets/skins/sam/carousel.css&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span></div></td></tr></tbody></table></div><p>In order for the Carousel to work properly, we will need the YUI Dom collection &amp; Event utilities, the Element utility (which provides an object to represent HTML elements), the animation utility and finally, the carousel component. They are minimised and combined by YUI and served to you as a single file. YUI is an unobtrusive framework, so add the following lines of HTML to the very bottom of your page just above the <kbd>&lt;/body&gt;</kbd> tag.</p><div
class="codecolorer-container html4strict twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table
cellspacing="0" cellpadding="0"><tbody><tr><td
style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br
/></div></td><td><div
class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/script.html"><span
style="color: #000000; font-weight: bold;">script</span></a> <span
style="color: #000066;">src</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://yui.yahooapis.com/combo?2.7.0/build/yahoo-dom-event/yahoo-dom-event.js&amp;amp;2.7.0/build/element/element-min.js&amp;amp;2.7.0/build/animation/animation-min.js&amp;amp;2.7.0/build/carousel/carousel-min.js&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;&lt;<span
style="color: #66cc66;">/</span><a
href="http://december.com/html/4/element/script.html"><span
style="color: #000000; font-weight: bold;">script</span></a>&gt;</span></div></td></tr></tbody></table></div><h2>Setting up &#8211; Javascript</h2><p>Now with all of the framework components in place, we can go about the work of setting up our carousel. For now we will do this by getting the id of the carousel&#8217;s wrapping <kbd>&lt;div&gt;</kbd>, but in <strong>Part II</strong> we will create the carousel based on class name so that we might have multiple instances.</p><p>Create a file called carousel.js in a Javascript folder, and link to it after the YUI scripts so it appears something like this:</p><div
class="codecolorer-container html4strict twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table
cellspacing="0" cellpadding="0"><tbody><tr><td
style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br
/></div></td><td><div
class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/script.html"><span
style="color: #000000; font-weight: bold;">script</span></a> <span
style="color: #000066;">src</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;js/carousel.js&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;&lt;<span
style="color: #66cc66;">/</span><a
href="http://december.com/html/4/element/script.html"><span
style="color: #000000; font-weight: bold;">script</span></a>&gt;</span></div></td></tr></tbody></table></div><p>Be aware that we create an instance of the carousel by passing in the <strong>id of the containing <kbd>&lt;div&gt;</kbd></strong>, not the ordered list. We also need to pass in a set of properties which are explained below. I have made our carousel variable into a property of our object so that we can easily have reference from additional methods of our object when we add more functionality later.</p><p>Once we have setup our carousel instance, we call <kbd>render</kbd>, <kbd>show</kbd>, and <kbd>startAutoPlay</kbd> to setup, display &amp; start the carousel. Of course none of this happens until the <kbd>init</kbd> method is called. As YUI is non-intrusive the methods to setup the carousel are called after the page has finished loading using <kbd>onDomReady</kbd>. I have added a test to the <kbd>onDomReady</kbd> function to ensure that the carousel id exists before we try using it to create an instance of the carousel widget.</p><div
class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:300px;"><table
cellspacing="0" cellpadding="0"><tbody><tr><td
style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br
/>2<br
/>3<br
/>4<br
/>5<br
/>6<br
/>7<br
/>8<br
/>9<br
/>10<br
/>11<br
/>12<br
/>13<br
/>14<br
/>15<br
/>16<br
/>17<br
/>18<br
/>19<br
/>20<br
/>21<br
/>22<br
/>23<br
/>24<br
/>25<br
/>26<br
/>27<br
/>28<br
/>29<br
/>30<br
/>31<br
/>32<br
/>33<br
/></div></td><td><div
class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #006600; font-style: italic;">//Setup a namespace to contain your own code within the YAHOO namespace</span><br
/> YAHOO.<span
style="color: #003366; font-weight: bold;">namespace</span><span
style="color: #009900;">&#40;</span><span
style="color: #3366CC;">&quot;ErisDS&quot;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #006600; font-style: italic;">//Create our carousel object literal with an init method</span><br
/> YAHOO.<span
style="color: #660066;">ErisDS</span>.<span
style="color: #660066;">Carousel</span> <span
style="color: #339933;">=</span> <span
style="color: #009900;">&#123;</span><br
/> &nbsp; carousel<span
style="color: #339933;">:</span> <span
style="color: #3366CC;">''</span><span
style="color: #339933;">,</span><br
/> &nbsp; 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><br
/> &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; <span
style="color: #000066; font-weight: bold;">this</span>.<span
style="color: #660066;">carousel</span> <span
style="color: #339933;">=</span> <span
style="color: #003366; font-weight: bold;">new</span> YAHOO.<span
style="color: #660066;">widget</span>.<span
style="color: #660066;">Carousel</span><span
style="color: #009900;">&#40;</span><span
style="color: #3366CC;">&quot;my-carousel&quot;</span><span
style="color: #339933;">,</span> <br
/> &nbsp; &nbsp; <span
style="color: #009900;">&#123;</span> <br
/> &nbsp; &nbsp; &nbsp; autoPlayInterval<span
style="color: #339933;">:</span> 5000<span
style="color: #339933;">,</span> <br
/> &nbsp; &nbsp; &nbsp; isCircular<span
style="color: #339933;">:</span> <span
style="color: #003366; font-weight: bold;">true</span><span
style="color: #339933;">,</span> <br
/> &nbsp; &nbsp; &nbsp; animation<span
style="color: #339933;">:</span> <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; speed<span
style="color: #339933;">:</span> 0.5<br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&#125;</span><span
style="color: #339933;">,</span> <br
/> &nbsp; &nbsp; &nbsp; numVisible<span
style="color: #339933;">:</span> 1<br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&#125;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span> <br
/> &nbsp; &nbsp; <br
/> &nbsp; &nbsp; <span
style="color: #000066; font-weight: bold;">this</span>.<span
style="color: #660066;">carousel</span>.<span
style="color: #660066;">render</span><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <span
style="color: #000066; font-weight: bold;">this</span>.<span
style="color: #660066;">carousel</span>.<span
style="color: #660066;">show</span><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span> &nbsp; <span
style="color: #006600; font-style: italic;">// display the widget</span><br
/> &nbsp; &nbsp; <span
style="color: #000066; font-weight: bold;">this</span>.<span
style="color: #660066;">carousel</span>.<span
style="color: #660066;">startAutoPlay</span><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #009900;">&#125;</span><br
/> <span
style="color: #009900;">&#125;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #006600; font-style: italic;">//onDomReady check to see if our carousel exists, and call the setup function</span><br
/> YAHOO.<span
style="color: #660066;">util</span>.<span
style="color: #660066;">Event</span>.<span
style="color: #660066;">onDOMReady</span><span
style="color: #009900;">&#40;</span><br
/> &nbsp; <span
style="color: #003366; font-weight: bold;">function</span> <span
style="color: #009900;">&#40;</span>ev<span
style="color: #009900;">&#41;</span> <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; <span
style="color: #000066; font-weight: bold;">if</span><span
style="color: #009900;">&#40;</span>YAHOO.<span
style="color: #660066;">util</span>.<span
style="color: #660066;">Dom</span>.<span
style="color: #660066;">get</span><span
style="color: #009900;">&#40;</span><span
style="color: #3366CC;">&quot;my-carousel&quot;</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; &nbsp; YAHOO.<span
style="color: #660066;">ErisDS</span>.<span
style="color: #660066;">Carousel</span>.<span
style="color: #660066;">init</span><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <span
style="color: #009900;">&#125;</span><br
/> &nbsp; <span
style="color: #009900;">&#125;</span><br
/> <span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span></div></td></tr></tbody></table></div><p>Copy the code above into your Javascript file. You should now have a working carousel.</p><h3>The Properties</h3><dl><dt>autoPlayInterval: 5000</dt><dd>How many milliseconds between transitions (i.e. 5 seconds)</dd><dt>isCircular: true</dt><dd>Previous &amp; next button are always active as when the carousel gets to the last item it carries on back to the first.</dd><dt>animation: { speed: 1.0 }</dt><dd>How long it takes for a transition from one item to the next to complete. 1.0 is one second.</dd><dt>numVisible: 1</dt><dd>How many items are visible at any one time.</dd></dl><p><strong>Note:</strong> The configuration attribute used to make the YUI Carousel autoplay changed somewhere between YUI 2.6 &amp; 2.7 from <kbd>autoPlay</kbd>, to <kbd>autoPlayInterval</kbd>. It works the same way, but there is no backwards compatibility.</p><h2>Tidying up &#8211; A little Custom CSS</h2><p>Depending on your browser and any other CSS you have present on the page your carousel may have some spacing which makes it look untidy. The following CSS is designed to ensure the carousel fits snug around the images and looks smart.</p><div
class="codecolorer-container css twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table
cellspacing="0" cellpadding="0"><tbody><tr><td
style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br
/>2<br
/>3<br
/>4<br
/>5<br
/>6<br
/>7<br
/>8<br
/>9<br
/>10<br
/>11<br
/>12<br
/>13<br
/>14<br
/>15<br
/>16<br
/>17<br
/>18<br
/></div></td><td><div
class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #cc00cc;">#my-carousel</span> .carousel-container<span
style="color: #00AA00;">&#123;</span><br
/> <span
style="color: #000000; font-weight: bold;">width</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">500px</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #000000; font-weight: bold;">height</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">364px</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #000000; font-weight: bold;">margin</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">0px</span> <span
style="color: #993333;">auto</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #00AA00;">&#125;</span><br
/> <br
/> <span
style="color: #cc00cc;">#my-carousel</span> ol.carousel-<span
style="color: #000000; font-weight: bold;">content</span><span
style="color: #00AA00;">&#123;</span><br
/> <span
style="color: #000000; font-weight: bold;">margin</span><span
style="color: #00AA00;">:</span><span
style="color: #933;">0px</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #000000; font-weight: bold;">padding</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">0px</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #000000; font-weight: bold;">list-style</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">none</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #00AA00;">&#125;</span><br
/> <br
/> <span
style="color: #cc00cc;">#my-carousel</span> ol.carousel-<span
style="color: #000000; font-weight: bold;">content</span> li<span
style="color: #00AA00;">&#123;</span><br
/> <span
style="color: #000000; font-weight: bold;">margin</span><span
style="color: #00AA00;">:</span><span
style="color: #933;">0px</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #000000; font-weight: bold;">padding</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">0px</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #000000; font-weight: bold;">width</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">500px</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #000000; font-weight: bold;">height</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">364px</span><span
style="color: #00AA00;">;</span><br
/> <span
style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div><p>The <a
href="http://erisds.co.uk/resources/yui-carousel-demo-i">finished article is basically an image slideshow</a>.  In the next part we will drop the YUI CSS and customise the carousel and navigation. If you have had any problems following this tutorial or ended up with a different result, please drop me a comment and I&#8217;ll try to help out.</p><h3>Resources</h3><ul><li><a
href="http://developer.yahoo.com/yui/docs/YAHOO.widget.Carousel.html">Visit the API for a full list of available methods, properties and attributes.</a></li><li><a
title="YUI Dependency Configurator" href="http://developer.yahoo.com/yui/articles/hosting/">YUI Dependency Configurator</a></li><li><a
href="http://erisds.co.uk/resources/yui-carousel-demo-1">The demo page (1)</a></li></ul><p>Related posts:<ol><li><a
href='http://erisds.co.uk/code/yui-javascript-carousel-custom-navigation-part-2' rel='bookmark' title='Permanent Link: YUI: Javascript Carousel with Custom Navigation &#8211; Part 2'>YUI: Javascript Carousel with Custom Navigation &#8211; Part 2</a> <small>Welcome to Part 2 of my YUI Carousel series. If...</small></li><li><a
href='http://erisds.co.uk/symfony/symfony-what-is-it-good-for' rel='bookmark' title='Permanent Link: Symfony: What is it good for?'>Symfony: What is it good for?</a> <small>Symfony is one of my favourite bits of technology. I’ve...</small></li><li><a
href='http://erisds.co.uk/general/its-been-a-very-quiet-month' rel='bookmark' title='Permanent Link: It&#8217;s been a Very Quiet Month&#8230;'>It&#8217;s been a Very Quiet Month&#8230;</a> <small>It's now been over a month since my last post...</small></li></ol></p>]]></content:encoded> <wfw:commentRss>http://erisds.co.uk/code/yui-javascript-carousel-custom-navigation-part-1/feed</wfw:commentRss> <slash:comments>16</slash:comments> </item> </channel> </rss><!-- This site's performance optimized by W3 Total Cache. Dramatically improve the speed and reliability of your blog!

Learn more about our WordPress Plugins: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk
Database Caching 46/212 queries in 0.864 seconds using disk

Served from: DSX4001-21.guardiandns.com @ 2010-03-08 18:55:56 -->
