<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>teddy-risation &#187; Javascript</title>
	<atom:link href="http://teddy-o-ted.com/blog/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://teddy-o-ted.com</link>
	<description>Design of a minimalist, content of a maximalist</description>
	<lastBuildDate>Mon, 07 Nov 2011 17:41:03 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<item>
		<title>Implementing sIFR 3</title>
		<link>http://teddy-o-ted.com/blog/2009/05/26/implementing-sifr-3/</link>
		<comments>http://teddy-o-ted.com/blog/2009/05/26/implementing-sifr-3/#comments</comments>
		<pubDate>Mon, 25 May 2009 17:38:39 +0000</pubDate>
		<dc:creator>Terry</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[sIFR]]></category>
		<category><![CDATA[Text Replacement]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.teddy-o-ted.com/?p=3712</guid>
		<description><![CDATA[When teddy-risation Theta was released a few days ago, I packed a feature that was previously not present in my older themes &#8211; text replacement for headers, namely the post and page titles. Eli expressed the difficulty in implementing sIFR3 on a webpage on Twitter, so I thought that it&#8217;ll be great if I can [...]]]></description>
			<content:encoded><![CDATA[<p>When teddy-risation Theta was released a few days ago, I packed a feature that was previously not present in my older themes &#8211; text replacement for headers, namely the post and page titles. <a title="Eli" href="http://mochaspot.blogspot.com/">Eli</a> expressed the difficulty in implementing sIFR3 on a webpage on Twitter, so I thought that it&#8217;ll be great if I can share how I did that for my blog in the recent makeover.</p>
<h2>Embedding a font</h2>
<p>There are other ways to embed a font in a webpage &#8211; you can use <a title="Font Descriptions and @font-face - CSS3 Module" href="http://www.w3.org/TR/css3-webfonts/#font-descriptions">@font-face</a> in your CSS (it&#8217;s part of the CSS3 module) or the <a title="Web Embedding Fonts Tool (WEFT)" href="http://www.microsoft.com/typography/WEFT.mspx">Web Embedding Fonts Tool (WEFT)</a> by Microsoft. In my first few years of blogging when I was blatantly unaware of proper typography and appropriate choice of fonts, I used WEFT to embed the font Kristen ITC in many of my blog pages.</p>
<p>However, both methods have their own shortcomings &#8211; cross-browser support for @font-face is patchy at best, while WEFT is only recognised by Internet Explorer and not in other major browsers people are currently using to prowl the interwebs.</p>
<h2>Dynamic text replacement</h2>
<p>Then we have brilliant people developing different methods of text replacement &#8211; the idea behind these methods is the same: to replace a block of text of a common font to a block of text with a desired font, either by means of rendering an image or placing a flash movie in the original position of the text block.</p>
<p><strong>Facelift Image Replacement</strong> (<a title="Facelift Image Replacement" href="http://facelift.mawhorter.net/learn-more/">FLIR</a>), by <a title="Cory Mawhorter" href="http://www.mawhorter.net/">Cory Mawhorter</a>, is a great way to replace text with images &#8211; the javascript scans the page for text blocks to be replace. FLIR finds the ones that you&#8217;ve specified. It screams of joy, grabs the text and sends it to a PHP script where it parses whatever text that is in the block. Transparent PNG images are rendered as a result, and they are sent back to the browser for display.</p>
<p><strong>Scalable Inman Flash Replacement</strong> (sIFR, <a title="sIFR 2.0: Rich Accessible Typography for the Masses" href="http://www.mikeindustries.com/blog/sifr/">version 2</a> and see the latest <a title="sIFR 3" href="http://novemberborn.net/sifr3">version 3</a>), by <a title="Mike Davidson" href="http://www.mikeindustries.com/">Mike Davidson</a> and <a title="Mark Wubben" href="http://www.novemberborn.net/">Mark Wubben</a>, and initially conveived by <a title="Shaun Inman" href="http://www.shauninman.com/">Shaun Inman</a>, uses flash videos to replace selected blocks of text. Javascript checks for Flash installation and then places a flash video file in place. The flash video file loads the font, and starting from 6 point font size, upsizes the font until it fits snugly.</p>
<p>What happens when Javascript is not available? For both FLIR and sIFR, they degrade gracefully and nothing happens &#8211; the text still displays, but in the original font-family that you&#8217;ve specified in your stylesheet, and nothing is royally screwed up :)</p>
<p>For this tutorial, I will be demonstrating how to get sIFR 3 installed, up and running on your webpage or blog. This tutorial is also helpful for those who&#8217;re intending to upgrade from sIFR 2 to sIFR 3 &#8211; the Javascript implementation is a little different between the two versions, so upgrading is not as simple as I initially imagined (that&#8217;s why I had to pull the Maintenance Mode page up for 2 hours).</p>
<p><span id="more-3712"></span></p>
<h2>sIFR 3: Getting started</h2>
<p>*Note: There is a <a title="sIFR 3 - How to use" href="http://wiki.novemberborn.net/sifr3/How+to+use">great guide</a> for those who intend to install sIFR 3, but here&#8217;s my version of it:</p>
<p>First of all, head over to the <a title="sIFR 3" href="http://novemberborn.net/sifr3">sIFR 3 page</a> and <a title="sIFR 3 - Nightlies" href="http://dev.novemberborn.net/sifr3/nightlies/">grab a nightly build</a> of it &#8211; of course, you should get the most recent one. I have r436 installed and everything is running good so far &#8211; do note that there will most probably be newer nightlies released after this tutorial is posted, so do keep yourself updated about it. If you&#8217;re lazy to update, just stick to the current nightly you&#8217;ve donwloaded and it should work just fine.</p>
<p>When you extract the .zip file, you will find four folders. You can either upload them under the folder name <code>/sifr/</code> to your webpage, o you can reorganize the files in anyway you want, as long as you keep track of the changes in the paths to the javascript files. <strong>Do note that the demo pages do not work on your computer</strong> (i.e. when loaded locally) due to security restrictions &#8211; instead, you will have to upload them to a web directory to view the demo. Thankfully, in order to understand how sIFR 3 is implemented on the page, you can always open the <code>index.html</code> or <code>index.xhtml</code> files with notepad or any other text editor your wish for referrence.</p>
<h2>Embedding your own fonts, and additional glyphs if needed</h2>
<p>One of the folders will be named /flash/. Open the folder, and you will find a file, sifr.fla. Open it up with Adobe Flash and <a title="sIFR 3 - Opening up sIFR.fla" href="http://www.teddy-o-ted.com/wp-content/uploads/2009/05/sifr3_01.png" rel="lightbox[3712]">you&#8217;ll see something like this</a>. You don&#8217;t see a single thing, but don&#8217;t panic &#8211; at least you&#8217;ll see a box with blue borders. Double click on it, and check the &#8216;Properties&#8217; tab. If it is not open, you can access it via<strong> Windows &gt; Properties &gt; Properties</strong>, or with the [Ctrl] + F3 keyboard shortcut.</p>
<p>By this time, <a title="sIFR 3 - Revealing the text" href="http://www.teddy-o-ted.com/wp-content/uploads/2009/05/sifr3_02.png" rel="lightbox[3712]">some words would have magically appeared within the blue borders</a>. If the border appears to be dotted, click once inside the boundary and the words should appear. Head over to the &#8216;Properties&#8217; tab, and under the choice of fonts (it&#8217;s Verdana by default), select the font you want. To cut down on the size of the flash movie file, you can remove all the text and only add those that you need &#8211; for example, if you only need a bold typeface, toggle the <img class="size-full wp-image-3720" title="sIFR 3 - Bold button" src="http://www.teddy-o-ted.com/wp-content/uploads/2009/05/sifr3_04.png" alt="sIFR 3 - Bold button" width="24" height="20" /> button and type one character. The same applies for italic <img class="size-full wp-image-3721" title="sIFR 3 - Italic button" src="http://www.teddy-o-ted.com/wp-content/uploads/2009/05/sifr3_05.png" alt="sIFR 3 - Italic button" width="24" height="20" />, bold and italic <img class="size-full wp-image-3722" title="sIFR 3 - Bold and Italic buttons" src="http://www.teddy-o-ted.com/wp-content/uploads/2009/05/sifr3_06.png" alt="sIFR 3 - Bold and Italic buttons" width="46" height="20" /> and normal. Depending on the need, you may embed additional glyphs (e.g. accents, common on many other languages) by clicking on the <img class="size-full wp-image-3717" title="Embed button" src="http://www.teddy-o-ted.com/wp-content/uploads/2009/05/sifr3_03.png" alt="Embed button" width="75" height="21" /> button.</p>
<p>When you&#8217;re done, go to <strong>File &gt; Export &gt; Export Movie</strong>, or press [Ctrl] + [Alt] + [Shift] + [S]. It is recommended that you name the movie with the name of the typeface, to make things easier (very good for people like me with goldfish memory). You arrive at the export options. Here&#8217;s a checklist to make sure that it&#8217;s correctly exported:</p>
<ul>
<li>Version, set it to Flash Player 8</li>
<li>Load order, set it to Bottom up</li>
<li>ActionScript version, set it to ActionScript 2.0</li>
<li>Options:
<ul>
<li>Protect from import, check</li>
<li>Omit trace actions, check</li>
<li>Permit debugging, uncheck</li>
<li>Compress movie, check</li>
</ul>
</li>
</ul>
<p>Other options that are not mentioned in the checklist is unne</p>
<h2>Loading the right stuff</h2>
<p>Between the <code>&lt;head&gt; ... &lt;/head&gt;</code> tags, you will have to load the correct javascript files:</p>
<ol class="code">
<li><code>&lt;script src="/path/to/sifr.js" type="text/javascript"&gt;&lt;/script&gt;</code></li>
<li><code>&lt;script src="/path/to/sifr-config.js" type="text/javascript"&gt;&lt;/script&gt;</code></li>
</ol>
<p>For me, since I have placed the files under my WP theme directory, under the <code>/sifr/</code> folder and I preserved the original folder organisation (so the .js files will all be under the <code>/js/</code> folder), my path will be <code>/path/to/theme/sifr/js/</code>. For WordPress users, you can use:</p>
<ol class="code">
<li><code>&lt;script src="&lt;?php bloginfo('stylesheet_directory'); ?&gt;/sifr/js/sifr.js" type="text/javascript"&gt;&lt;/script&gt;</code></li>
<li><code>&lt;script src="&lt;?php bloginfo('stylesheet_directory'); ?&gt;/sifr/js/sifr-config.js" type="text/javascript"&gt;&lt;/script&gt;</code></li>
</ol>
<p>Here are the purpose of loading the two files:</p>
<ol>
<li><strong>sifr.js</strong> is the core javascript file of sIFR &#8211; it does all the hard work in replacing the text based on selectors that you&#8217;ve specified (don&#8217;t panic, we&#8217;ll get to that later) and unless you understand what the codes inside mean, don&#8217;t touch them.</li>
<li><strong>sifr-config.js</strong> is the file where requires your attention &#8211; it is the configuration file that is the center of the implementation of sIFR.</li>
</ol>
<p>The reason why two files are separated is for the ease of upgrade &#8211; <code>sifr.js</code> will be upgraded as of when needed, while <code>sifr-config.js</code> need not be modified and should be left untouched during an upgrade, unless you have the intention to modify what sIFR replaces on your webpage or there&#8217;s a change of typeface.</p>
<h2>Dissecting and configuring sifr-config.js</h2>
<p>The authors are terribly nice to provide us with a <code>sifr-config.js</code> file that is heavily annotated. Don&#8217;t get busy removing those lines because they only weigh a few kb at most &#8211; more importantly, they contain vital information in how you should modify the file. For reasons of spacial efficiency, I removed the comments and kept only the crucial lines intact.</p>
<h3>1. Defining the font</h3>
<pre><code>var futura = { src: '/path/to/futura.swf' };</code></pre>
<p>It is recommended that you use the variable that share the same name as your font. It makes things a little easier. This tells the script where to load the font movie file. I am using a font called Alte Haas Grotesk, so I will modify this line accordingly:</p>
<pre><code>var altehaasgrotesk = { src: '/path/to/altehaasgrotesk.swf' };</code></pre>
<p>To those who are unaware of it, <code>/path/to/</code> is a dummy path &#8211; it doesn&#8217;t exist. I used an absolute path because I&#8217;m too lazy to figure out the relative path of the font movie file, but you can always use relative paths if you wish to.</p>
<h3>2. Activate sIFR</h3>
<pre><code>sIFR.activate(altehaasgrotesk);</code></pre>
<p>This line calls for the activation of sIFR. There can only be one sIFR.activate() function &#8211; so, if you have multiple movies to load, simply separate the names of their respective variables with a comma. For example, if I chose to load both Futura and Alte Haas Grotesk, I will write:</p>
<pre><code>sIFR.activate(altehaasgrotesk, futura);</code></pre>
<p>Of course, that means that you will have to specify the variable &#8216;future&#8217;, as mentioned in the previous section. There&#8217;s no limit on the number of variables you can declare.</p>
<h3>3. Font replacement</h3>
<p>Now the fun begins &#8211; you call for the replacement of certain chunks of text, using CSS selectors (if you&#8217;re familiar with CSS, awesome!). If you are clueless of what CSS selectors are, here&#8217;s a <a title="CSS Selectors" href="http://www.w3.org/TR/CSS2/selector.html">good article to get you started</a>.</p>
<ol class="code">
<li><code>sIFR.replace(altehaasgrotesk, {</code></li>
<li class="indent1"><code>selector: '.entry-title, .category-title, .date-title, .search-title, .tag-title',</code></li>
<li class="indent1"><code>wmode: 'transparent',</code></li>
<li class="indent1"><code>css: [</code></li>
<li class="indent2"><code>'.sIFR-root { background-color: #e5e5e5; color: #1a4051; }',</code></li>
<li class="indent2"><code>'a { color: #1a4051; text-decoration: none; }',</code></li>
<li class="indent2"><code>'a:hover { color: #2d657e; text-decoration: none; }'</code></li>
<li class="indent1"><code>]</code></li>
<li><code>});</code></li>
</ol>
<p>The first line calls for the variable <code>altehaasgrotesk</code>, which represents the source file of the font movie file. Then, you specify what chunks of text should sIFR replace &#8211; in this example, I instruct it to replace all the text contained within elements with the class of entry-title, category-title and etc. Yes, it does support single and multiple selectors, and even IDs (e.g. div#post-234 .entry-title). If you&#8217;re familiar with CSS, this part shouldn&#8217;t be a problem for you.</p>
<p>The third line is necessary if you&#8217;re using a model window plugin, e.g. Lightbox, Facebox, or anything that requires overlaying something over the flash movie. Without setting the wmode to transparent, the flash movie will show through regardless of how high you set the overlaying element&#8217;s z-index. It may cause some minor display bugs on Mozilla browsers upon scrolling, but so far I&#8217;ve encountered none &#8211; the ones I encountered were when sIFR 2.0.7 was installed. sIFR 3 seems to fix a lot of it!</p>
<p>The fourth line, we move on to the styling of the replaced text &#8211; everything works as per normal like in CSS. The sIFR-root class is the class assigned to the element that wraps around the replaced text. I specified the background colour and text colour here. Now you ask, what if I have a link? Can I modify the colour and the appearance as well? The answer is yes &#8211; on a new line, simply add the appropriate styling necessary. If you do not specify anything for the link, the color reverts to blue, and the link is underlined (both are browser defaults).</p>
<p>Do take note of the commas present after each link except for the last, as well as the brackets and the type of it used. A single error can result the texts not being replaced.</p>
<h3>4. More CSS styling</h3>
<p>In the <code>/css/</code> folder, there is a lone file <code>sift.css</code> in there. Usually you don&#8217;t need any modifcation to the file and I did most of the styling of the replaced text in the <code>sifr-config.js</code> file. Do note that styling of the replaced text, e.g. font size, will have an effect on the appearance of the final sIFR text as well &#8211; varying the font size modifies the font size in the sIFR replaced text. Most of the time, the dimensions occupied by the original text and the replaced text are almost the same due to the brilliant calculation algorithm, so when deciding on what font style you&#8217;re using, try without sIFR activated first. After you&#8217;ve get the desirable font size, activate sIFR and see magic happens :) usually there isn&#8217;t much discrepancy, no worries.</p>
<h3  class="related_post_title">Related</h3><p>Related posts that might interest you:</p><ul class="related_post"><li><a href="http://teddy-o-ted.com/blog/2008/05/14/designing-is-fun-a-wordpress-poster/" title="Designing is Fun &#8211; a Wordpress Poster">Designing is Fun &#8211; a Wordpress Poster</a></li><li><a href="http://teddy-o-ted.com/blog/2010/05/22/wp-widget-load-posts-in-a-category/" title="WP Widget: Load posts in a category">WP Widget: Load posts in a category</a></li><li><a href="http://teddy-o-ted.com/blog/2009/12/28/black-and-white-conversion-a-how-to-guide/" title="Black and white conversion &#8211; A how-to guide">Black and white conversion &#8211; A how-to guide</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://teddy-o-ted.com/blog/2009/05/26/implementing-sifr-3/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>8 Javascript solutions to common CSS problems</title>
		<link>http://teddy-o-ted.com/blog/2009/03/24/8-javascript-solutions-to-common-css-problems/</link>
		<comments>http://teddy-o-ted.com/blog/2009/03/24/8-javascript-solutions-to-common-css-problems/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 20:34:45 +0000</pubDate>
		<dc:creator>Terry</dc:creator>
				<category><![CDATA[Bookmarked]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Fix]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.teddy-o-ted.com/?p=3384</guid>
		<description><![CDATA[Jean-Baptiste Jung shares <a title="8 Javascript solutions to common CSS problems" href="http://www.catswhocode.com/blog/8-javascript-solutions-to-common-css-problems">8 ingenious jQuery-based javascript solutions</a> on CatsWhoCode.comto circumvent the common CSS problems. While CSS is a semantically correct way of styling your webpages, not all popular browsers (like IE6, I know this comes very naturally for a designer) support CSS3 and there's always this problem of cross-browser compatibility.]]></description>
			<content:encoded><![CDATA[<div id="attachment_3386" class="wp-caption aligncenter" style="width: 610px"><a href="http://www.catswhocode.com/blog/8-javascript-solutions-to-common-css-problems"><img class="size-full wp-image-3386" title="8 Javascript solutions to common CSS problems" src="http://www.teddy-o-ted.com/wp-content/uploads/2009/03/8jsfixesforcss.jpg" alt="8 Javascript solutions to common CSS problems" width="600" height="233" /></a><p class="wp-caption-text">8 Javascript solutions to common CSS problems</p></div>
<p>Jean-Baptiste Jung shares <a title="8 Javascript solutions to common CSS problems" href="http://www.catswhocode.com/blog/8-javascript-solutions-to-common-css-problems">8 ingenious jQuery-based javascript solutions</a> on CatsWhoCode.comto circumvent the common CSS problems. While CSS is a semantically correct way of styling your webpages, not all popular browsers (like IE6, I know this comes very naturally for a designer) support CSS3 and there&#8217;s always this problem of cross-browser compatibility. Little do many people know that Javascript can actually fix a myriad of CSS problems &#8211; you&#8217;ve never thought they go along well together, do you?</p>
<p>From important fixes like the jQuery PNG transparency fix to the absolutely evil IE6-crashing script (so as to scare visitors into switching browsers, or is it more like scaring visitors away? That&#8217;s up to you), this article is a must-read for designers and coders alike.</p>
<h3  class="related_post_title">Related</h3><p>Related posts that might interest you:</p><ul class="related_post"><li><a href="http://teddy-o-ted.com/blog/2009/03/22/easy-display-switch-with-css-and-jquery/" title="Easy Display Switch with CSS and jQuery">Easy Display Switch with CSS and jQuery</a></li><li><a href="http://teddy-o-ted.com/blog/2009/02/21/compacting-contents-using-glider-script/" title="Compacting contents using Glider script">Compacting contents using Glider script</a></li><li><a href="http://teddy-o-ted.com/blog/2008/09/05/fix-for-buggy-flickr-badge-js/" title="Fix for buggy Flickr badge JS">Fix for buggy Flickr badge JS</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://teddy-o-ted.com/blog/2009/03/24/8-javascript-solutions-to-common-css-problems/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Easy Display Switch with CSS and jQuery</title>
		<link>http://teddy-o-ted.com/blog/2009/03/22/easy-display-switch-with-css-and-jquery/</link>
		<comments>http://teddy-o-ted.com/blog/2009/03/22/easy-display-switch-with-css-and-jquery/#comments</comments>
		<pubDate>Sat, 21 Mar 2009 17:39:51 +0000</pubDate>
		<dc:creator>Terry</dc:creator>
				<category><![CDATA[Bookmarked]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Fluid]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Switch]]></category>

		<guid isPermaLink="false">http://www.teddy-o-ted.com/?p=3360</guid>
		<description><![CDATA[As javascript libraries becomes increasingly popular among designers and website visitors alike, your daily visitors are now expecting more than just static pages - they would be thrilled to see interactive, fluid pages. In 2006 <a title="In Search of the Holy Grail" href="http://www.alistapart.com/articles/holygrail/">A List Apart published an article</a> on the holy grail of webdesign, which involves coding for fluid layouts in CSS. With the popularity of  javascript libraries like jQuery, <a title="Easy Display Switch with CSS and jQuery" href="http://designm.ag/tutorials/jquery-display-switch/">Soh Tanaka has written an excellent tutorial</a> on teaching us how to incorporate fluid display options on our pages - allowing visitors to switch between different forms of display (think iTunes libraries). An interesting concept that is actually very simple, and can be easily done with a few lines of jQuery and CSS.]]></description>
			<content:encoded><![CDATA[<div id="attachment_3361" class="wp-caption aligncenter" style="width: 610px"><a href="http://designm.ag/tutorials/jquery-display-switch/"><img class="size-full wp-image-3361" title="Easy Display Switch with CSS and jQuery" src="http://www.teddy-o-ted.com/wp-content/uploads/2009/03/displayswitch01.jpg" alt="Easy Display Switch with CSS and jQuery" width="600" height="588" /></a><p class="wp-caption-text">Easy Display Switch with CSS and jQuery</p></div>
<p>As javascript libraries becomes increasingly popular among designers and website visitors alike, your daily visitors are now expecting more than just static pages &#8211; they would be thrilled to see interactive, fluid pages. In 2006 <a title="In Search of the Holy Grail" href="http://www.alistapart.com/articles/holygrail/">A List Apart published an article</a> on the holy grail of webdesign, which involves coding for fluid layouts in CSS. With the popularity ofÂ  javascript libraries like jQuery, <a title="Easy Display Switch with CSS and jQuery" href="http://designm.ag/tutorials/jquery-display-switch/">Soh Tanaka has written an excellent tutorial</a> on teaching us how to incorporate fluid display options on our pages &#8211; allowing visitors to switch between different forms of display (think iTunes libraries). An interesting concept that is actually very simple, and can be easily done with a few lines of jQuery and CSS.</p>
<p>Basically, the technique behind the display switch is simply to style the list containing the gallery items separately &#8211; one in the thumbnail form and the other in the detailed listing form. And then you will use jQuery to add/remove a class that is appended to the list, to achieve the different appearance all coded by CSS.</p>
<h3  class="related_post_title">Related</h3><p>Related posts that might interest you:</p><ul class="related_post"><li><a href="http://teddy-o-ted.com/blog/2009/03/24/8-javascript-solutions-to-common-css-problems/" title="8 Javascript solutions to common CSS problems">8 Javascript solutions to common CSS problems</a></li><li><a href="http://teddy-o-ted.com/blog/2009/02/21/compacting-contents-using-glider-script/" title="Compacting contents using Glider script">Compacting contents using Glider script</a></li><li><a href="http://teddy-o-ted.com/blog/2006/11/09/whats-up-2/" title="What&#8217;s Up?">What&#8217;s Up?</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://teddy-o-ted.com/blog/2009/03/22/easy-display-switch-with-css-and-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compacting contents using Glider script</title>
		<link>http://teddy-o-ted.com/blog/2009/02/21/compacting-contents-using-glider-script/</link>
		<comments>http://teddy-o-ted.com/blog/2009/02/21/compacting-contents-using-glider-script/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 23:25:17 +0000</pubDate>
		<dc:creator>Terry</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Coda]]></category>
		<category><![CDATA[Glider]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Library]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://www.teddy-o-ted.com/?p=3131</guid>
		<description><![CDATA[Thanks to Iva for requesting for this tutorial! Finally I have something to add to my long-dormant list of resources. Iva asked me over Twitter whether could I write a tutorial on how I&#8217;ve incorporated the famous Coda glider effect on my blog header. The basic function of the glider script is to replicate the [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-3154" title="Using Glider.js" src="http://www.teddy-o-ted.com/wp-content/uploads/2009/02/glider02.jpg" alt="Using Glider.js" width="600" height="542" /></p>
<p>Thanks to <a title="Iva @ Iva-is.me" href="http://www.iva-is.me/">Iva</a> for requesting for this tutorial! Finally I have something to add to my long-dormant list of resources. Iva asked me over Twitter whether could I write a tutorial on how I&#8217;ve incorporated the <a title="See Coda glider here!" href="http://www.panic.com/coda/">famous Coda glider effect</a> on my blog header. The basic function of the glider script is to replicate the effects of the Coda glider. Gliders, like accordions, are very useful in compressing/compacting contents in an area of a fixed size, and animate the process when a visitor switches between the different &#8216;panels&#8217; (which involves gliding, hence the name).</p>
<p>My previous themes were plagued with the problem of overcrowding, where I attempt to squeeze too much information into too little screen real estate space &#8211; resulting in a rather nasty, visitor-unfriendly clutter and confusion. When I <a title="Presenting teddY-risatioN Eta" href="http://www.teddy-o-ted.com/design/presenting-teddy-risation-eta/">redesigned</a> my blog, I kept that problem in mind and I was very impressed when I saw <a title="The Wojo Group" href="http://www.thewojogroup.com/">The Wojo Group</a>&#8216;s glider in action. It then led me to discovering the original synthesis of this idea at Coda, and to the Google Code page of <a title="MissingMethod Projects - Glider.js" href="http://code.google.com/p/missingmethod-projects/wiki/Glider">Glider.js</a>.</p>
<h2>What is glider.js?</h2>
<p>Glider.js is a rather lightweight javascript effect that weighs around 4kb <em>uncompressed</em>. So far I&#8217;ve not seen much development of the script after it&#8217;s previous update in May 2007, but for the moment being, it doesn&#8217;t have much issues with most major browsers (including IE6, <em>surprise!</em>). I&#8217;ve tested it in Firefox 2 and 3, Safari, Opera, Safari and Chrome, and it excelled in all these browsers. It is <a title="Download Glider.js" href="http://code.google.com/p/missingmethod-projects/downloads/list">downloadable over here</a>.</p>
<p>So are you ready to continue with the tutorial? Goodies after the jump, I promise!</p>
<p><span id="more-3131"></span></p>
<h2>Using the glider</h2>
<p>So now let&#8217;s move on to the part that lets you implement your own glider. There is a demo link at the end of the tutorial, but it&#8217;s always better to read through the details because that&#8217;s where the majority of the explaning goes to.</p>
<h3>What you will need</h3>
<p>Download the <a title="Glider.js" href="http://code.google.com/p/missingmethod-projects/downloads/list">Glider.js</a> and if you don&#8217;t have, <a title="Prototype.js" href="http://www.prototypejs.org/">Prototype.js</a> and <a title="Scriptaculous.js" href="http://script.aculo.us/">Scriptaculous.js</a>. Of course, if you&#8217;re using WordPress, you don&#8217;t have to worry about the latter because they&#8217;ve been taken care of by your WordPress installation. It&#8217;s safer to check your blog header and see if they&#8217;re loaded. If they&#8217;re not, you don&#8217;t need to actualy download them &#8211; you can simply load <a title="Google AJAX Libraries" href="http://code.google.com/apis/ajaxlibs/documentation/">Google AJAX Libraries</a> to make things easier:</p>
<ol class="code">
<li><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js"&gt;&lt;/script&gt;</code></li>
<li><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.2/scriptaculous.js"&gt;&lt;/script&gt;</code></li>
<li><code>&lt;script type="text/javascript" src="glider.js"&gt;&lt;/script&gt;</code></li>
</ol>
<p><strong>*Note: It&#8217;s absolutely important that you load the glider.js file <em>after</em> loading prototype and scriptaculous.</strong></p>
<p>Alternatively, if you prefer to use the <em>google.load</em> function:</p>
<ol class="code">
<li><code>&lt;script src="http://www.google.com/jsapi"&gt;&lt;/script&gt;</code></li>
<li><code>&lt;script type="text/javascript"&gt;</code></li>
<li class="indent1"><code>google.load("prototype", "1.6.0.3");</code></li>
<li class="indent1"><code>google.load("scriptaculous", "1.8.2");</code></li>
<li><code>&lt;/script&gt;</code></li>
<li><code>&lt;script type="text/javascript" src="glider.js"&gt;&lt;/script&gt;</code></li>
</ol>
<p>For WordPress users who prefer to place their glider.js file in their theme&#8217;s JS directory (recommended, and you can use any other names, just be sure to change the &#8216;/js/&#8217; into something else &#8211; &#8216;/name-of-directory/&#8217;), replace the last line above with:</p>
<ol class="code">
<li><code>&lt;script type="text/javascript" src="&lt;?php bloginfo('stylesheet_directory'); ?&gt;/js/glider.js"&gt;&lt;/script&gt;</code></li>
</ol>
<p>For more information on the Google AJAX Libraries, you can read <a title="Save Bandwidth by Serving jQuery, MooTools, Prototype via Googleâ€™s AJAX Libraries API" href="http://perishablepress.com/press/2008/11/25/save-bandwidth-by-serving-jquery-mootools-prototype-via-googles-ajax-libraries-api/">Jeff&#8217;s writeup</a>.</p>
<h3>Prior to setting up the glider</h3>
<p>Glider.js relies on using classes to identify the individual gliders, so you will have to make sure that the following classes are unused in your layout (except for elements meant for the glider):</p>
<ul>
<li>scroller</li>
<li>section</li>
<li>controls</li>
</ul>
<p><em>*Note to advanced coders: these classes are identified in the javascript file, so if you&#8217;re planning to use other classes, do keep track of the changes and replace the class names in the file with relevant ones.</em></p>
<p>Basically, you will have a <code>&lt;div class="scroller"&gt;</code> to serve as a window around the content, and then <code>&lt;div class="section"&gt;</code> to wrap around each individual panels (which will be glided over when the event is initiated by a user mouseclick on a link &#8211; we&#8217;ll come to that later) and then a <code>&lt;div class="controls"&gt;</code> to house the control tabs. For some designers, you might want a forward and backward button to be present &#8211; if that&#8217;s the case, you can make do without the <code>&lt;div class="controls"&gt;</code> part. Here&#8217;s a summary of what the individual classes serve as:</p>
<ul>
<li>scroller &#8211; serves as a window in which sections will appear, one at a time</li>
<li>section &#8211; wraps around contents in <em>individual panels</em> in the glider</li>
<li>controls &#8211; wraps around the <em>tabs</em> to allow navigation to any panel in the glider</li>
</ul>
<p>A very basic layout, as evient in the blog header in the current design, can be seen below:</p>
<div id="attachment_3133" class="wp-caption aligncenter" style="width: 610px"><img class="size-full wp-image-3133" title="Basic layout of a glider." src="http://www.teddy-o-ted.com/wp-content/uploads/2009/02/glider01.jpg" alt="Basic layout of a glider." width="600" height="153" /><p class="wp-caption-text">Basic layout of a glider.</p></div>
<p>The basic idea is that we will have the scroller to be of the same width of the panels &#8211; it will be the &#8216;window&#8217; in which the each section, or panel, is displayed. For this reason, all sections have to be of the same width. When the animation is not running, you will only see one section/panel in the window, and when you click on the navigation menu, the glider effects kicks in, fetches for the other section located outside of the window (see screenshot above) and repositions the new section in the window. That&#8217;s a mouthful! Now take a deep breath and try to digest it *burp*</p>
<p>And this brings us to the next section. Read on!</p>
<h3>Step 1 &#8211; Adding an overall and a content wrapper</h3>
<p>I have a habit of wrapping huge, chunky sections with a wrapper, so for this case, we will be using <code>&lt;div id="glider"&gt;</code>.</p>
<ol class="code">
<li><code>&lt;div id="glider"&gt;</code></li>
<li class="indent1"><code>...</code></li>
<li><code>&lt;/div&gt;</code></li>
</ol>
<p>Now we add in the scroller, and then the content wrapper that wraps around all the individual panels. We will also need to append the script that specifies the glider, <em>after</em> the entire glider element.</p>
<ol class="code">
<li><code>&lt;div id="glider"&gt;</code></li>
<li class="indent1"><code>&lt;div class="scroller"&gt;</code></li>
<li class="indent2"><code>&lt;div class="content"&gt;</code></li>
<li class="indent3"><code>...</code></li>
<li class="indent2"><code>&lt;/div&gt;</code></li>
<li class="indent1"><code>&lt;/div&gt;</code></li>
<li><code>&lt;/div&gt;</code></li>
<li><code>&lt;script type="text/javascript" charset="utf-8"&gt;var my_glider = new Glider('glider', {duration:0.5});&lt;/script&gt;</code></li>
</ol>
<p>*Note: If you have a different id for your glider container, you will have to make changes to the script &#8211; change the &#8216;glider&#8217; to &#8216;<em>your-own-id</em>&#8216;. The same applies if you want to vary the duration of transition/animation.</p>
<p>For the CSS, we want each section to be 500px wide and 200px tall. So we need to make the window of the same size too. In addition, we will make it such that the <code>&lt;div class="content"&gt;</code> is of a very huge width (to contain all the scrollers):</p>
<ol class="code">
<li><code>.scroller {</code></li>
<li class="indent1"><code>overflow: hidden;</code></li>
<li class="indent1"><code>width: 500px;</code></li>
<li class="indent1"><code>height: 200px;</code></li>
<li><code>}</code></li>
<li><code>.content {</code></li>
<li class="indent1"><code>width: 10000px;</code></li>
<li><code>}</code></li>
</ol>
<p>Everything cool so far? Now we move on to the second step.</p>
<h3>Step 2 &#8211; Adding in the sections</h3>
<p>Now we&#8217;re done with the wrappers (div-itis alert, yes, but that&#8217;s unavoidable). We shall add in the individual sections. Let&#8217;s say we want to have 5 sections, each 500px wide and 200px tall:</p>
<ol class="code">
<li><code>&lt;div id="glider"&gt;</code></li>
<li class="indent1"><code>&lt;div class="scroller"&gt;</code></li>
<li class="indent2"><code>&lt;div class="content"&gt;</code></li>
<li class="indent3"><code>&lt;div id="section1" class="section"&gt;...&lt;/div&gt;</code></li>
<li class="indent3"><code>&lt;div id="section2" class="section"&gt;...&lt;/div&gt;</code></li>
<li class="indent3"><code>&lt;div id="section3" class="section"&gt;...&lt;/div&gt;</code></li>
<li class="indent3"><code>&lt;div id="section4" class="section"&gt;...&lt;/div&gt;</code></li>
<li class="indent3"><code>&lt;div id="section5" class="section"&gt;...&lt;/div&gt;</code></li>
<li class="indent2"><code>&lt;/div&gt;</code></li>
<li class="indent1"><code>&lt;/div&gt;</code></li>
<li><code>&lt;/div&gt;</code></li>
<li><code>&lt;script type="text/javascript" charset="utf-8"&gt;var my_glider = new Glider('glider', {duration:0.5});&lt;/script&gt;</code></li>
</ol>
<p>*Note to those who are unfamiliar with CSS &#8211; &#8216;id&#8217; and &#8216;class&#8217; are two different things. A particular id can only appear in the entire document once &#8211; although modern browsers render multiple elements of the same id correctly, this should not be seen as valid XHTML. A class can appear multiple times in a document. We will apply a general style for all sections, so we target the class instead of the id.</p>
<p>To fix the dimensions of each section, we will have to turn to CSS for help:</p>
<ol class="code">
<li><code>.section {</code></li>
<li class="indent1"><code>float: left;</code></li>
<li class="indent1"><code>overflow: hidden;</code></li>
<li class="indent1"><code>padding: 10px;</code></li>
<li class="indent1"><code>width: 480px;</code></li>
<li class="indent1"><code>height: 180px;</code></li>
<li><code>}</code></li>
</ol>
<p>Some really, really important notes:</p>
<ul>
<li>Float the containers to the left so that they will be arranged horizontally.</li>
<li>Hide potential overflows so that it doesn&#8217;t screw up anything, just in case.</li>
<li><strong>The CSS box model</strong>: the total, intended height of an element is the sum of all the margins, paddings AND dimensions specificed. So if you want to have a 10px padding for contents in all sections, the width has to be reduced by 2*10px = 20px (because we have left and right paddings) and the same applies for height (because we have top and bottom paddings). For more information, read the <a title="CSS box model" href="http://www.w3.org/TR/CSS2/box.html">Box Model article</a>.</li>
</ul>
<h3>Step 3 &#8211; Adding and styling the controls</h3>
<p>For the controls, I have used a tabbed structure to arrange the individual links to each section. We will add it <em>outside</em> the scroller but <em>within</em> the entire glider wrapper:</p>
<ol class="code">
<li><code>&lt;div id="glider"&gt;</code></li>
<li class="indent1"><code>&lt;div class="scroller"&gt;</code></li>
<li class="indent2"><code>&lt;div class="content"&gt;</code></li>
<li class="indent3"><code>&lt;div id="section1" class="section"&gt;...&lt;/div&gt;</code></li>
<li class="indent3"><code>&lt;div id="section2" class="section"&gt;...&lt;/div&gt;</code></li>
<li class="indent3"><code>&lt;div id="section3" class="section"&gt;...&lt;/div&gt;</code></li>
<li class="indent3"><code>&lt;div id="section4" class="section"&gt;...&lt;/div&gt;</code></li>
<li class="indent3"><code>&lt;div id="section5" class="section"&gt;...&lt;/div&gt;</code></li>
<li class="indent2"><code>&lt;/div&gt;</code></li>
<li class="indent1"><code>&lt;/div&gt;</code></li>
<li class="indent1"><code>&lt;div class="controls"&gt;</code></li>
<li class="indent2"><code>&lt;ul&gt;</code></li>
<li class="indent3"><code>&lt;li&gt;&lt;a title="Go to Section 1" href="#section1"&gt;Section 1&lt;/a&gt;&lt;/li&gt;</code></li>
<li class="indent3"><code>&lt;li&gt;&lt;a title="Go to Section 2" href="#section2"&gt;Section 2&lt;/a&gt;&lt;/li&gt;</code></li>
<li class="indent3"><code>&lt;li&gt;&lt;a title="Go to Section 3" href="#section3"&gt;Section 3&lt;/a&gt;&lt;/li&gt;</code></li>
<li class="indent3"><code>&lt;li&gt;&lt;a title="Go to Section 4" href="#section4"&gt;Section 4&lt;/a&gt;&lt;/li&gt;</code></li>
<li class="indent3"><code>&lt;li&gt;&lt;a title="Go to Section 5" href="#section5"&gt;Section 5&lt;/a&gt;&lt;/li&gt;</code></li>
<li class="indent2"><code>&lt;/ul&gt;</code></li>
<li class="indent1"><code>&lt;/div&gt;</code></li>
<li><code>&lt;/div&gt;</code></li>
<li><code>&lt;script type="text/javascript" charset="utf-8"&gt;var my_glider = new Glider('glider', {duration:0.5});&lt;/script&gt;</code></li>
</ol>
<p>That&#8217;s a whole bunch of code! Basically what we are doing is that we&#8217;re adding an unordered list (which is to be styled, later) underneath the &#8216;window&#8217; (as seen in my blog header) to be the navigation menu. There are five sections, so normally you will need to place five tabs, in five <code>&lt;li&gt;</code> tags.</p>
<p>Now the styling!</p>
<ol class="code">
<li><code>.controls {</code></li>
<li class="indent1"><code>overflow: hidden;</code></li>
<li class="indent1"><code>width: 500px;</code></li>
<li class="indent1"><code>height: 30px;</code></li>
<li><code>}</code></li>
<li><code>.controls ul {</code></li>
<li class="indent1"><code>list-style: none;</code></li>
<li class="indent1"><code>margin: 0;</code></li>
<li class="indent1"><code>padding: 0;</code></li>
<li class="indent1"><code>width: 100%;</code></li>
<li><code>}</code></li>
<li><code>.controls ul li {</code></li>
<li class="indent1"><code>float: left;</code></li>
<li class="indent1"><code>width: 20%;</code></li>
<li><code>}</code></li>
<li><code>.controls ul li a {</code></li>
<li class="indent1"><code>display: block;</code></li>
<li class="indent1"><code>height: 20px;</code></li>
<li class="indent1"><code>line-height: 20px;</code></li>
<li class="indent1"><code>padding: 5px 0;</code></li>
<li class="indent1"><code>text-align: center;</code></li>
<li><code>}</code></li>
</ol>
<p>This is what we&#8217;ve done for the CSS part:</p>
<ul>
<li>Disable styles for the unordered list, set margin and padding to zero (just in case you haven&#8217;t done so in with a reset stylesheet, and defined its dimensions.</li>
<li>For the list items, we float them to the left to arrange them horizontally. There are 5 list items in total, so each of them take up 20% of the total width.</li>
<li>For the link in each list items, we set its display to block (by default, it&#8217;s in inline element) and by applying the box model, set height to 20px such that adding up the vertical paddings will be 30px. We also center the text.</li>
</ul>
<p><strong>We&#8217;re done with the basic structure of the glider! If you&#8217;re satisfied, you&#8217;re done for good!</strong></p>
<h3>Step 4 &#8211; Backward and forward buttons</h3>
<p>The buttons can be implemented without the tabs, with the tabs or be thrown out of the window. It all boils down to personal preferences. For me, I&#8217;ve used a combination of both. So far, we&#8217;ve been doing the basic structure without taking the buttons into mind. If we want to, modifications to the structure above have to be made.</p>
<p>In this example, we will be adding buttons to two-sides of the scroller:</p>
<ol class="code">
<li><code>&lt;div id="glider"&gt;</code></li>
<li class="indent1"><code>&lt;div id="nav-previous" class="side-nav"&gt;</code></li>
<li class="indent2"><code>&lt;a title="Previous" href="#" onclick="my_glider.previous();return false;"&gt;Previous&lt;/a&gt;</code></li>
<li class="indent1"><code>&lt;/div&gt;</code></li>
<li class="indent1"><code>&lt;div class="scroller"&gt;</code></li>
<li class="indent2"><code>&lt;div class="content"&gt;</code></li>
<li class="indent3"><code>&lt;div id="section1" class="section"&gt;...&lt;/div&gt;</code></li>
<li class="indent3"><code>&lt;div id="section2" class="section"&gt;...&lt;/div&gt;</code></li>
<li class="indent3"><code>&lt;div id="section3" class="section"&gt;...&lt;/div&gt;</code></li>
<li class="indent3"><code>&lt;div id="section4" class="section"&gt;...&lt;/div&gt;</code></li>
<li class="indent3"><code>&lt;div id="section5" class="section"&gt;...&lt;/div&gt;</code></li>
<li class="indent2"><code>&lt;/div&gt;</code></li>
<li class="indent1"><code>&lt;/div&gt;</code></li>
<li class="indent1"><code>&lt;div id="nav-next" class="side-nav"&gt;</code></li>
<li class="indent2"><code>&lt;a title="Next" href="#" onclick="my_glider.next();return false;"&gt;Next&lt;/a&gt;</code></li>
<li class="indent1"><code>&lt;/div&gt;</code></li>
<li class="indent1"><code>&lt;div class="controls"&gt;</code></li>
<li class="indent2"><code>&lt;ul&gt;</code></li>
<li class="indent3"><code>&lt;li&gt;&lt;a title="Go to Section 1" href="#section1"&gt;Section 1&lt;/a&gt;&lt;/li&gt;</code></li>
<li class="indent3"><code>&lt;li&gt;&lt;a title="Go to Section 2" href="#section2"&gt;Section 2&lt;/a&gt;&lt;/li&gt;</code></li>
<li class="indent3"><code>&lt;li&gt;&lt;a title="Go to Section 3" href="#section3"&gt;Section 3&lt;/a&gt;&lt;/li&gt;</code></li>
<li class="indent3"><code>&lt;li&gt;&lt;a title="Go to Section 4" href="#section4"&gt;Section 4&lt;/a&gt;&lt;/li&gt;</code></li>
<li class="indent3"><code>&lt;li&gt;&lt;a title="Go to Section 5" href="#section5"&gt;Section 5&lt;/a&gt;&lt;/li&gt;</code></li>
<li class="indent2"><code>&lt;/ul&gt;</code></li>
<li class="indent1"><code>&lt;/div&gt;</code></li>
<li><code>&lt;/div&gt;</code></li>
<li><code>&lt;script type="text/javascript" charset="utf-8"&gt;var my_glider = new Glider('glider', {duration:0.5});&lt;/script&gt;</code></li>
</ol>
<p>So, we&#8217;ve added the previous and next links to the side of the scroller, and attached the javascript funciton to them to move the sections. We need to refine their appearance using CSS:</p>
<ol class="code">
<li><code>.side-nav {</code></li>
<li class="indent1"><code>float: left;</code></li>
<li class="indent1"><code>width: 20px;</code></li>
<li class="indent1"><code>height: 200px;</code></li>
<li><code>}</code></li>
<li><code>.side-nav a {</code></li>
<li class="indent1"><code>display: block;</code></li>
<li class="indent1"><code>text-indent: -9999px;</code></li>
<li class="indent1"><code>width: 20px;</code></li>
<li class="indent1"><code>height: 200px;</code></li>
<li><code>}</code></li>
<li><code>#nav-previous a {</code></li>
<li class="indent1"><code>background: url(images/previous-arrow.png) no-repeat center center;</code></li>
<li><code>}</code></li>
<li><code>#nav-next a {</code></li>
<li class="indent1"><code>background: url(images/next-arrow.png) no-repeat center center;</code></li>
<li><code>}</code></li>
</ol>
<p>Basically, what we did to the buttons is:</p>
<ul>
<li>To give them a definite width and height (preferably spanning the height of scroller).</li>
<li>Display links as a block element, indent the text by -9999px so that it&#8217;s off the screen but still readable by search engine bots.</li>
<li>Customize background images for each button.</li>
</ul>
<p>Then replace the styles for certain elements with the new ones below:</p>
<ol class="code">
<li><code>.scroller {</code></li>
<li class="indent1"><code>float: left;</code></li>
<li class="indent1"><code>overflow: hidden;</code></li>
<li class="indent1"><code>width: 500px;</code></li>
<li class="indent1"><code>height: 200px;</code></li>
<li><code>}</code></li>
<li><code>.controls {</code></li>
<li class="indent1"><code>clear: both;</code></li>
<li class="indent1"><code>overflow: hidden;</code></li>
<li class="indent1"><code>width: 540px;</code></li>
<li class="indent1"><code>height: 30px;</code></li>
<li><code>}</code></li>
<li><code>.controls ul {</code></li>
<li class="indent1"><code>list-style: none;</code></li>
<li class="indent1"><code>margin: 0 auto;</code></li>
<li class="indent1"><code>padding: 0;</code></li>
<li class="indent1"><code>width: 500px;</code></li>
<li><code>}</code></li>
</ol>
<p>The modifications are necessary because:</p>
<ul>
<li>We have added two 20px wide buttons on the side, so the overall width has increased to 540px.</li>
<li>The controls are widened to 540px as well, but if you want to keep the menu the same width as the scroller (at 500px), fix width to 500px as well and use automatic left and right margin to center the menu.</li>
<li>Clear the floats above the controls.</li>
</ul>
<p>We also need to use the <a title="Easy Clearing" href="http://www.positioniseverything.net/easyclearing.html">clearfix</a> method to making sure that all the list items are cleared properly. Change <code>&lt;ul&gt;</code> to <code>&lt;ul class="clearfix"&gt;</code>. To the CSS, add the lines:</p>
<ol class="code">
<li><code>.clearfix:after {</code></li>
<li class="indent1"><code>clear: both;</code></li>
<li class="indent1"><code>content: ".";</code></li>
<li class="indent1"><code>display: block;</code></li>
<li class="indent1"><code>height: 0;</code></li>
<li class="indent1"><code>visibility: hidden;</code></li>
<li><code>}</code></li>
</ol>
<h2>Issues</h2>
<p>There are several things that might not work well with this glider script:</p>
<ul>
<li>If you&#8217;re using an older version of Lightbox, you might encounter a javascript error and the glider will not work &#8211; neither will the Lightbox. If that&#8217;s the case, I recommend you to upgrade to <a title="Lightbox 2" href="http://www.huddletogether.com/projects/lightbox2/">Lightbox 2</a>. If you&#8217;re a WordPress user, I highly recommend <a title="Lightbox 2.8.0 plugin for WordPress" href="http://stimuli.ca/lightbox/">Lightbox 2.8.0 plugin for WordPress</a> &#8211; not only does it work perfectly for me, it allows you to customize your lightbox as well.</li>
<li>If you&#8217;re using an <code>&lt;iframe&gt;</code> in the section that has a scrollbar, there might be a minor graphical glitch in Firefox. I am unable to reproduce the glitch in Safari, Chrome, IE (surprise!) and Opera. It seems to be an issue with Firefox?</li>
<li>Flash movie will show even when the section it is contained in is not in the &#8216;window&#8217;. So the conventional YouTube snippets will cause your Flash Movie to appear towards the left/right of the &#8216;window&#8217;. You will have to add the following lines to the code: within the <code>&lt;object&gt;</code> element, add <code>&lt;param name="wmode" value="transparent"&gt;&lt;/param&gt;</code>; and to the <code>&lt;embed&gt;</code>, add <code>wmode="transparent"</code>.</li>
</ul>
<h2>Finally, the demo!</h2>
<p>Yes, there is a demo file that comes with this tutorial &#8211; just follow the link to the demo page. Do not right click and download, as the download manager I&#8217;m currently using masks the original URL, so you&#8217;ll be downloading a blank file instead. If you want to get the code, just follow the link and save the page that is loaded thereafter.</p>
<p class="download download-html" title="Download link for Glider Demo"><a href="http://teddy-o-ted.com/download/8" title="Download link for Glider Demo."><span class="download-title"><strong>Download</strong>: Glider Demo</span><span class="download-stats">Version 1.0  File size: 4 KB  1642 downloads</span></a></p>
<p>I hope the tutorial and demo is of good use to you. Have fun! If you have any queries, feel free to leave a comment. Thanks!</p>
<h3  class="related_post_title">Related</h3><p>Related posts that might interest you:</p><ul class="related_post"><li><a href="http://teddy-o-ted.com/blog/2009/03/24/8-javascript-solutions-to-common-css-problems/" title="8 Javascript solutions to common CSS problems">8 Javascript solutions to common CSS problems</a></li><li><a href="http://teddy-o-ted.com/blog/2009/03/22/easy-display-switch-with-css-and-jquery/" title="Easy Display Switch with CSS and jQuery">Easy Display Switch with CSS and jQuery</a></li><li><a href="http://teddy-o-ted.com/blog/2008/03/18/rollover-effects-made-easy-with-css/" title="Rollover Effects Made Easy &#8211; with CSS!">Rollover Effects Made Easy &#8211; with CSS!</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://teddy-o-ted.com/blog/2009/02/21/compacting-contents-using-glider-script/feed/</wfw:commentRss>
		<slash:comments>42</slash:comments>
		</item>
		<item>
		<title>Using Zeroclipboard for WordPress Comments</title>
		<link>http://teddy-o-ted.com/blog/2009/02/15/using-zeroclipboard-for-wordpress-comments/</link>
		<comments>http://teddy-o-ted.com/blog/2009/02/15/using-zeroclipboard-for-wordpress-comments/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 14:40:07 +0000</pubDate>
		<dc:creator>Terry</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Clipboard]]></category>
		<category><![CDATA[Copy]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.teddy-o-ted.com/?p=3088</guid>
		<description><![CDATA[When Adobe introduced the new Flash 10 a few months back, it led to a rather huge, grand backlash from the online community for breaking various uploading tools on many websites, including WordPress and Flickr, for screwing with SWFUpload. Not only that, it also breaks the default &#8220;copy to clipboard&#8221; functionality offered by many javascript [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_3102" class="wp-caption aligncenter" style="width: 610px"><img src="http://www.teddy-o-ted.com/wp-content/uploads/2009/02/zeroclipboard01.jpg" alt="Using Zeroclipboard for WP comments" title="Using Zeroclipboard for WP comments" width="600" height="240" class="size-full wp-image-3102" /><p class="wp-caption-text">Using Zeroclipboard for WP comments</p></div>
<p>When Adobe introduced the new Flash 10 a few months back, it led to a rather huge, grand backlash from the online community for breaking various uploading tools on many websites, including WordPress and Flickr, for screwing with <a title="SWFUpload" href="http://www.swfupload.org/">SWFUpload</a>. Not only that, it also breaks the default &#8220;copy to clipboard&#8221; functionality offered by many javascript resource sites on the Internet, <a title="Flash 10 and WordPress File Upload Problems" href="http://www.hyperborea.org/journal/archives/2008/10/16/flash-10-wp-upload/">frustrating</a> <a title="Flash Player 10 Beta breaks file upload" href="http://wordpress.org/support/topic/177127">millions</a> <a title="Flash 10 and the bad news for JavaScript interaction" href="Flash 10 and the bad news for JavaScript interaction">out</a> <a title="Flash Player 10 Security - breaking the web" href="http://www.bit-101.com/blog/?p=1382">there</a>. The reactions from Internet users, although varied, are more or less the same &#8211; they wanted Flash 10 the work the same way as Flash 9 does, when it comes to clipboard copy and uploading.</p>
<h2>It&#8217;s a fix, not a bug</h2>
<p>Adobe didn&#8217;t budge for a simple reason &#8211; the fix is meant to be a <em>fix</em> and not a <em>bug</em>. The security measure implemented in Flash 10 means that instead of blindly allowing any interactions between javascript and a flash file, users with the new Flash 10 installed have to <em>click on the Flash player itself</em> to initiate any action. A very good way to thawrt malicious scripts from fooling around with loopholes, but also a very good way to break the web (although not as bad as the transition from IE6 to IE7 and now, IE8).</p>
<p>A few months after the introduction of Flash 10, both WordPress and Flickr have came out with genious ways to fix their uploader, so it shouldn&#8217;t be a very huge problem to all. That only solves part of the problem &#8211; what about copy to clipboard functions? Check it out after the jump:</p>
<p><span id="more-3088"></span></p>
<h2>Using Zeroclipboard</h2>
<p>Believe me or not, this tutorial is going to be very simple, given the fact that I&#8217;m not that well-versed when it comes to Javascript. I even had to look up for a list of eventhandlers because I&#8217;ve forgotten most of them *weak smiles*</p>
<p>The interest in restoring the &#8220;copy to clipboard&#8221; function was rekindled in me over the weekend when I realized how important is it to offer your commentators an option to copy their comment to their clipboard, just in case anything goes wrong. On the other hand, there are also other reasons why one might want to offer such a feature &#8211; for example, copying a permalink, a shortened url, a piece of text and etc. <a title="Zeroclipboard" href="http://code.google.com/p/zeroclipboard/">Zeroclipboard</a> is one of the easiest solution to the broken function caused by Flash 10. Having <a title="jQuery" href="http://jquery.com/">jQuery</a> installed will be handy, so be sure that you have it &#8211; if you&#8217;re using WordPress, you will most probably not need to worry about that.</p>
<p>More detailed and all-encompassing usage of Zeroclipboard is available at their <a title="Zeroclipboard - Instructions" href="http://code.google.com/p/zeroclipboard/wiki/Instructions">Google Code &#8216;Instruction&#8217; page</a>.</p>
<h3>Getting started</h3>
<p>Obviously, Step 0 is as simple as <a title="Zeroclipboard - Download" href="http://code.google.com/p/zeroclipboard/downloads/list">downloading the library</a>.  Upload the following two files from the unzipped directory to a certain directory on your site:</p>
<ul>
<li>ZeroClipboard.js</li>
<li>ZeroClipboard.swf</li>
</ul>
<p>Let&#8217;s say that we will be uploading it to a theme folder, <em>http://www.domain.com/wp-content/themes/wp-theme/js</em>. Of course some of you have your own ways to organize your files, such as directly uploading them to the <em>js</em> folder located in the root directory, but since I wanted it to be theme-specific, I&#8217;ve decided to throw it into my theme&#8217;s <em>js</em> folder.</p>
<p>First of all, you will need to have the Zeroclipboard loaded. To specify the directory of the theme currently in use, we can use the following PHP-Javascript hybrid:</p>
<ol class="code">
<li><code>&lt;script type="text/javascript" src="&lt;?php bloginfo('stylesheet_directory'); ?&gt;/js/ZeroClipboard.js"&gt;&lt;/script&gt;</code></li>
</ol>
<p>Given the example above, <code>&lt;?php bloginfo('stylesheet_directory'); ?&gt;</code> will give us <em>http://www.domain.com/wp-content/themes/wp-theme/</em>.</p>
<h3>Appending functions</h3>
<p>The following lines are to be added between the <code>&lt;script type="text/javascript"&gt; ... &lt;/script&gt;</code> tags, unless otherwise mentioned.</p>
<p>Since we&#8217;re talking about a WordPress blog over here, the javascript file will usually not be located at the root directory of the page you&#8217;re viewing. Zeroclipboard comes with a handy function that allows you to specify the exact location of the file: </p>
<ol class="code">
<li><code>ZeroClipboard.setMoviePath( 'http://www.domain.com/wp-content/themes/wp-theme/js/ZeroClipboard.swf' );</code></li>
</ol>
<p>Now this part is gonna be a mouthful:</p>
<ul>
<li>You will have to declare and set the value of a variable called &#8216;clip&#8217;, and call for a new client &#8211; you will usually need only one unless you want to have multiple instances of the clipboard copy button on the same page.</li>
<li>We also need an event listener such that whenever a certain action occurs to the button, we will copy whatever content that is inside a specified element to the clipboard.</li>
<li>If you want to let the visitor know that the text has been successfully copied to clipboard, you might want to change the value of the button.</li>
<li>Last, but not least, we need to do some gluing fun. Gluing will generate a flash movie of an identical size to the DOM element you&#8217;ve specified by the element id.</li>
</ul>
<p>Summarizing what is in the list above, you arrive at the initialization function:</p>
<ol class="code">
<li><code>var clip = null;</code></li>
<li><code>function init() {</code></li>
<li class="indent1"><code>clip = new ZeroClipboard.Client();</code></li>
<li class="indent1"><code>clip.addEventListener('mouseOver', my_mouse_over);</code></li>
<li class="indent1"><code>clip.addEventListener( 'onComplete', my_complete );</code></li>
<li class="indent1"><code>clip.glue( 'clipboard' );</code></li>
<li><code>}</code></li>
</ol>
<p>What happens when you hover your mouse over the button? Now that&#8217;s something we will be address here:</p>
<ol class="code">
<li><code>function my_mouse_over(client) {</code></li>
<li class="indent1"><code>clip.setText( document.getElementById('comment').value );</code></li>
<li><code>}</code></li>
</ol>
<p>Informing the commentator that his/her comment has been successfully copied to clipboard, you don&#8217;t want to use an alert box &#8211; that&#8217;s something that might annoy them. You can change the value of the button so that it displays a success message when the copying is done. A setTimeout function can be added if you want the innerHTML to be reset back to the original &#8216;Copy to Clipboard?&#8217; text. Also, helping them to refocus back to the comment textfield will be handy too.</p>
<ol class="code">
<li><code>function my_complete(client) {</code></li>
<li class="indent1"><code>document.getElementById('clipboard').value = "Comment copied";</code></li>
<li class="indent1"><code>document.getElementById('comment').focus();</code></li>
<li class="indent1"><code>setTimeout ( "resetbutton()", 3000 );</code></li>
<li><code>}</code></li>
</ol>
<p>Another issue to deal with &#8211; the button sticks to the value of &#8220;Comment copied&#8221; after clicking the button. We need an extra mechanism to make sure that the value is reset to the original value of the button. There are definitely more sophisticated ways to store and then redisplay the original value of the button, but I&#8217;m still new to Javascript so we&#8217;ll have to do it the idiot-proof way (again):</p>
<ol class="code">
<li><code>function resetbutton() {</code></li>
<li class="indent1"><code>document.getElementById('clipboard').innerHTML = "Copy to clipboard?";</code></li>
<li><code>}</code></li>
</ol>
<p>Now this is the optional part. If you&#8217;re having a WordPress plugin that changes the position of the button, what should you do? Do note that the absolute positioning of the flash movie over the DOM element (in this case, the button) is done when the page loads. It does not track live changes in the button&#8217;s position after the page is loaded. The button on my current theme changes position because I have WP Thread Comment plugin activated &#8211; if a commentator chooses to respond to another&#8217;s comment, the comment form will be nested in the original comment to facilitate cross referencing.</p>
<p>If that&#8217;s the case, we will have to create another function that will reposition the button. I am not very javascript savvy, so I don&#8217;t know a simpler way to do it, but my idiot-proof method will be appending the onmouseover eventhandler to the &lt;form&gt; element. It will instruct to reposition the button when the user hovers around the form (which will be the case when the form dynamically switches position across the page). Thank goodness, they have a reposition function included in the library. All we need to do is call for it:</p>
<ol class="code">
<li><code>function hoverreposition() {</code></li>
<li class="indent1"><code>clip.reposition();</code></li>
<li><code>}</code></li>
</ol>
<p>If you combine everything, here&#8217;s what you should see:</p>
<ol class="code">
<li><code>&lt;script type="text/javascript" src="&lt;?php bloginfo('stylesheet_directory'); ?&gt;/js/ZeroClipboard.js"&gt;&lt;/script&gt;</code></li>
<li><code>&lt;script type=&quot;text/javascript&quot;&gt;</code></li>
<li class="indent1"><code>ZeroClipboard.setMoviePath( 'http://www.teddy-o-ted.com/wp-content/themes/Teddyrisationeta/js/ZeroClipboard.swf' );</code></li>
<li class="indent1"><code>var clip = null;</code></li>
<li class="indent1"><code>function init() {</code></li>
<li class="indent2"><code>clip = new ZeroClipboard.Client();</code></li>
<li class="indent2"><code>clip.addEventListener('mouseOver', my_mouse_over);</code></li>
<li class="indent2"><code>clip.addEventListener( 'onComplete', my_complete );</code></li>
<li class="indent2"><code>clip.glue( 'clipboard' );</code></li>
<li class="indent1"><code>}</code></li>
<li class="indent1"><code>function my_mouse_over(client) {</code></li>
<li class="indent2"><code>clip.setText( document.getElementById('comment').value );</code></li>
<li class="indent1"><code>}</code></li>
<li class="indent1"><code>function my_complete(client) {</code></li>
<li class="indent2"><code>document.getElementById('clipboard').innerHTML = "Comment copied";</code></li>
<li class="indent2"><code>document.getElementById('comment').focus();</code></li>
<li class="indent2"><code>setTimeout ( "resetbutton()", 3000 );</code></li>
<li class="indent1"><code>}</code></li>
<li class="indent1"><code>function hoverreposition() {</code></li>
<li class="indent2"><code>clip.reposition();</code></li>
<li class="indent1"><code>}</code></li>
<li class="indent1"><code>function resetbutton() {</code></li>
<li class="indent2"><code>document.getElementById('clipboard').innerHTML = "Copy to clipboard?";</code></li>
<li class="indent1"><code>}</code></li>
<li><code>&lt;/script&gt;</code></li>
</ol>
<p>Possible modifications to this script will be directly inserting the javascript commands into comments.php, and you can even save the file as <em>ZeroClipboard-functions.js</em> and import it using the following code:</p>
<ol class="code">
<li><code>&lt;script type="text/javascript" src="&lt;?php bloginfo('stylesheet_directory'); ?&gt;/js/ZeroClipboard-functions.js"&gt;&lt;/script&gt;</code></li>
</ol>
<p>If you&#8217;re concerned about the weight of the JS file(s), you can always use the <a href="http://javascriptcompressor.com/" title="Javascript Compressor">Javascript Compressor</a> to help you zip everything up. Now you&#8217;re almost done with the javascript part!</p>
<h3>Preparing your page</h3>
<p>For simplicity reasons, I will be using the default Kubrick theme as our reference.</p>
<p>You have all the essential javascript functions in place. What you need to do now is to load the function to get everything working smoothly by loading the first function into your document body. In addition, you do not want the <em>init</em> function to be loaded when the page doesn&#8217;t contain a comment form. Head over to <strong>header.php</strong> now and search for the &lt;body&gt; tag. Replace it with this:</p>
<ol class="code">
<li><code>&lt;body&lt;?php if (is_single()) { ?&gt; onload=&quot;init()&quot;&lt;?php } ?&gt;&gt;</code></li>
</ol>
<p>Note: If you have comments enabled on your pages as well, you will need to use this instead:</p>
<ol class="code">
<li><code>&lt;body&lt;?php if (is_single() || is_page()) { ?&gt; onload=&quot;init()&quot;&lt;?php } ?&gt;&gt;</code></li>
</ol>
<p>Of course, there might be instances when you have comment forms elsewhere on your blog &#8211; on the index page and etc. There are a whole list of <a href="http://codex.wordpress.org/Conditional_Tags"title="Conditional Comments">conditional comments</a>  available at the WordPress Codex to help you with this.</p>
<h3>Modifying comment.php</h3>
<p>We&#8217;re dealing with copying a comment entered in the WP comment form, so you will probably see the following HTML code (or something similar) in your <strong>comments.php</strong> file:</p>
<ol class="code">
<li><code>&lt;form action=&quot;&lt;?php echo get_option('siteurl'); ?&gt;/wp-comments-post.php&quot; method=&quot;post&quot; id=&quot;commentform&quot;&gt;</code></li>
<li><code>...</code></li>
<li><code>&lt;p&gt;&lt;textarea name=&quot;comment&quot; id=&quot;comment&quot; cols=&quot;100%&quot; rows=&quot;10&quot; tabindex=&quot;4&quot;&gt;&lt;/textarea&gt;&lt;/p&gt;</code></li>
<li><code>&lt;p&gt;&lt;input name=&quot;submit&quot; type=&quot;submit&quot; id=&quot;submit&quot; tabindex=&quot;5&quot; value=&quot;Submit Comment&quot; /&gt;</code></li>
<li><code>&lt;?php comment_id_fields(); ?&gt;</code></li>
<li><code>&lt;/p&gt;</code></li>
<li><code>...</code></li>
<li><code>&lt;/form&gt;</code></li>
</ol>
<p>We will now add a new button to the bottom of the comment form such that it will allow your visitor to copy his/her comment to the clipboard. Now you might be thinking, why did I choose to use a block-level element &lt;div&gt; instead of using &lt;input&gt;? Here are two simple reason (thanks to the author for <a href="http://code.google.com/p/zeroclipboard/issues/detail?id=6" title="Size of flash movie not the same as DOM element in IE">replying to my question</a>):</p>
<ul>
<li>It is not a block-level element, so measuring its actual size is next to impossible</li>
<li>The library cannot propagate mouse events to simulate the mouse down state</li>
</ul>
<p>The reason is simple &#8211; it is almost impossible for the .Don&#8217;t forget to call for the <em>resetform</em> function on the submit button:</p>
<ol class="code">
<li><code>&lt;form action=&quot;&lt;?php echo get_option('siteurl'); ?&gt;/wp-comments-post.php&quot; method=&quot;post&quot; id=&quot;commentform&quot;&gt;</code></li>
<li><code>...</code></li>
<li><code>&lt;p&gt;&lt;textarea name=&quot;comment&quot; id=&quot;comment&quot; cols=&quot;100%&quot; rows=&quot;10&quot; tabindex=&quot;4&quot; onmouseover=&quot;hoverreposition()&quot;&gt;&lt;/textarea&gt;&lt;/p&gt;</code></li>
<li><code>&lt;p&lt;div id=&quot;clipboard&quot;&gt;Copy to clipboard?&lt;/div&gt;</code></li>
<li><code>&lt;input name=&quot;submit&quot; type=&quot;submit&quot; id=&quot;submit&quot; tabindex=&quot;5&quot; value=&quot;Submit Comment&quot; onclick=&quot;resetbutton()&quot; /&gt;</code></li>
<li><code>&lt;?php comment_id_fields(); ?&gt;</code></li>
<li><code>&lt;/p&gt;</code></li>
<li><code>...</code></li>
<li><code>&lt;/form&gt;</code></li>
</ol>
<h2>We&#8217;re done!</h2>
<p>So now you will have a neat new button in your comments section that allows your commentators to copy their comment if they see the need to. I hope you find this tutorial useful! I&#8217;m not some javascript guru, so if there&#8217;s anyone out there who finds that there are mistakes/problems in this tutorial or there are easier ways to achieve the effect, do drop a comment to notify me. Thanks!</p>
<h3  class="related_post_title">Related</h3><p>Related posts that might interest you:</p><ul class="related_post"><li><a href="http://teddy-o-ted.com/blog/2008/05/14/designing-is-fun-a-wordpress-poster/" title="Designing is Fun &#8211; a Wordpress Poster">Designing is Fun &#8211; a Wordpress Poster</a></li><li><a href="http://teddy-o-ted.com/blog/2010/05/22/wp-widget-load-posts-in-a-category/" title="WP Widget: Load posts in a category">WP Widget: Load posts in a category</a></li><li><a href="http://teddy-o-ted.com/blog/2009/09/10/35-stylish-and-modern-wordpress-plugins-using-jquery-ui/" title="35 Stylish And Modern Wordpress Plugins Using jQuery UI">35 Stylish And Modern Wordpress Plugins Using jQuery UI</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://teddy-o-ted.com/blog/2009/02/15/using-zeroclipboard-for-wordpress-comments/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Fix for buggy Flickr badge JS</title>
		<link>http://teddy-o-ted.com/blog/2008/09/05/fix-for-buggy-flickr-badge-js/</link>
		<comments>http://teddy-o-ted.com/blog/2008/09/05/fix-for-buggy-flickr-badge-js/#comments</comments>
		<pubDate>Fri, 05 Sep 2008 14:34:36 +0000</pubDate>
		<dc:creator>Terry</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Badge]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[Cascading Stylesheet]]></category>
		<category><![CDATA[Fix]]></category>
		<category><![CDATA[Flickr]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Problem]]></category>
		<category><![CDATA[Workaround]]></category>

		<guid isPermaLink="false">http://www.teddy-o-ted.com/?p=2366</guid>
		<description><![CDATA[Yep, you didn&#8217;t read it wrongly &#8211; the javascript which Flick gave you to insert your personalised Flickr badge is indeed buggy! It just happened over the afternoon &#8211; the Flickr badge JS has some new modifications which will potentially affect the layout of your blog. The crux of the problem If you have the [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-2378 aligncenter" title="Buggy Flickr Badge JS" src="http://www.teddy-o-ted.com/wp-content/uploads/2008/09/buggyflickrbadgejs01.png" alt="Buggy Flickr Badge JS" width="600" height="56" /></p>
<p>Yep, you didn&#8217;t read it wrongly &#8211; the javascript which Flick gave you to insert your personalised Flickr badge <a title="Badge JS Gone Haywire?" href="http://www.flickr.com/help/forum/en-us/80505/#reply509981" target="_blank">is indeed buggy</a>! It just happened over the afternoon &#8211; the <a title="Flickr Badge" href="http://www.flickr.com/badge.gne" target="_blank">Flickr badge JS</a> has some new modifications which will potentially affect the layout of your blog.</p>
<h2>The crux of the problem</h2>
<p>If you have the script, look into the source of the script. The follow is the badge code for my script, after following <a title="Flickr badge W3C valid" href="http://veerle.duoh.com/blog/comments/fickr_badge_w3c_valid/" target="_blank">Veerle&#8217;s simple steps</a> of converting the code to make it XHTML valid:</p>
<pre><code>&lt;script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?count=4&amp;amp;display=random&amp;amp;size=s&amp;amp;layout=x&amp;amp;source=user&amp;amp;user=44742295%40N00"&gt;</code></pre>
<p>Highlight everything between the inverted commas after <code>src=</code>, then copy + paste it to your address bar. You should arrive at a page which displays something like this:</p>
<pre><code>var b_txt = '&lt;img src="http://geo.yahoo.com/p?s=792600102&amp;t=ad64ee1b82b556e2adac6caee93c4ae5&amp;fl_ev=0âŒ©=en&amp;intl=sg" width="0" height="0" alt="" /&gt;';

// write the badge

document.write(b_txt)
//document.write(b_txt.split('&lt; ').join('&lt;'))</code></pre>
<p>You will notice that Flickr Badge JS has sneakily appended the HTML code of including an empty gif at the start of your Flickr badge. And to my horror, the addition of that innocent-looking transparent gif screwed up the design of the main page of my blog.</p>
<h2>Distorted layout</h2>
<div id="attachment_2379" class="wp-caption alignright" style="width: 215px"><img class="size-full wp-image-2379" title="Buggy Flickr Badge JS - Image displacement" src="http://www.teddy-o-ted.com/wp-content/uploads/2008/09/buggyflickrbadgejs02.jpg" alt="Buggy Flickr Badge JS - Image displacement" width="205" height="220" /><p class="wp-caption-text">Image displacement is observed.</p></div>
<p>As you can see from the image to the right, the usual styling I&#8217;ve applied to my Flickr images has caused the transparent gif to affect the position of the rest of the images such that the last one is pushed off the container. I&#8217;ve set a definite height and <code>overflow: hidden</code> to the container such that content overflows will not affect the rest of the content.</p>
<p>The little blue square at the top right hand corner is the cause of the problem &#8211; since I&#8217;ve set the width of the container such that the images fit snugly into it, any additional space will cause the images to be pushed to the subsequent row. Thus in the screenshot, the second image (that photo of a shrimp salad) which should appear on the first line was pushed to the second row. This causes the last image to be positioned way off the fixed dimensions of the container.</p>
<h2>Workaround #1 &#8211; Excluding the transparent gif</h2>
<p>If you&#8217;d scrutinise the irritating image the Flickr badge JS has inserted in, you will realise that while other displayed Flickr photos will be wrapped around the link tag:</p>
<pre><code>&lt;a href="ImagePageURL" title="ImageDesc"&gt;&lt;img src="ImageURL" title="ImageDesc"&gt;&lt;/a&gt;</code></pre>
<p>&#8230; while the miserable little pain-in-the-ass transparent gif is just an <strong>unlinked</strong> image. The unlinked image is where this first workaround is taking advantage of. My old CSS styling for the images were (simplified for presentation purposes):</p>
<ol class="code">
<li><code>div#flickr img {</code></li>
<li class="indent1"><code>border: 4px solid #a4b6d2;</code></li>
<li class="indent1"><code>float: left;</code></li>
<li class="indent1"><code>margin: 0 4px 4px 0;</code></li>
<li class="indent1"><code>padding: 0;</code></li>
<li><code>}</code></li>
<li><code> </code></li>
<li><code>div#flickr img:hover {</code></li>
<li class="indent1"><code>border: 4px solid #ffffff;</code></li>
<li><code>}</code></li>
</ol>
<p>The problem is immediately clear &#8211; I&#8217;m assigning a 4px border to the transparent gif too! This will create an 12px wide unnecessary space (4px for left border, 4px for right border and 4px for the margin), thus pushing the second, fourth, sixth and etc to the next row. To circumvent the problem:</p>
<p><strong>Method 1:</strong> You&#8217;ll just need to change your code such that the border only targets <strong>linked</strong> images (since the transparent 1x1px gif is not linked).</p>
<ol class="code">
<li><code>div#flickr <strong>a</strong> img {</code></li>
<li class="indent1"><code>border: 4px solid #a4b6d2;</code></li>
<li class="indent1"><code>float: left;</code></li>
<li class="indent1"><code>margin: 0 4px 4px 0;</code></li>
<li class="indent1"><code>padding: 0;</code></li>
<li><code>}</code></li>
<li><code> </code></li>
<li><code>div#flickr <strong>a</strong> img:hover {</code></li>
<li class="indent1"><code>border: 4px solid #ffffff;</code></li>
<li><code>}</code></li>
</ol>
<p><strong>Method 2:</strong> Alternatively, if you&#8217;re reluctant to use the &#8216;border&#8217; attribute but wishes to add borders to your images, <a title="Veerle @ Veerle.duoh.com" href="http://veerle.duoh.com/" target="_blank">Veerle</a>&#8216;s has got a neat workaround for it. I&#8217;ve used the concept behind her workaround and modified it a little for personal use:</p>
<ol class="code">
<li><code>div#flickr a img {</code></li>
<li class="indent1"><code>background: #a4b6d2;</code></li>
<li class="indent1"><code>float: left;</code></li>
<li class="indent1"><code>margin: 0 4px 4px 0;</code></li>
<li class="indent1"><code>padding: 4px;</code></li>
<li class="indent1"><code>width: 75px;</code></li>
<li class="indent1"><code>height: 75px;</code></li>
<li><code>}</code></li>
<li><code> </code></li>
<li><code>div#flickr a img:hover {</code></li>
<li class="indent1"><code>background: #ffffff;</code></li>
<li><code>}</code></li>
</ol>
<p>Her method is to pre-define the size of the image, then assign a fixed padding to them and then define the background colour. This creates borders around the images. The <code>img:hover</code> property is a pseudo-class &#8211; whenever you hover your cursor over that image the background changes colour.</p>
<p><strong>*Disadvantage of Method 1 and Method 2 (both are under Workaround #1):</strong> This is merely a stop-gap measure &#8211; this means that if Flickr ever does edit their sneaky Flickr badge javascript, you might need to think of an alternative workaround. For example, if Flickr links the transparent gif, this workaround will not work. This brings us to the second fix.</p>
<h2>Workaround #2 &#8211; Targeting the transparent gif</h2>
<p>Another workaround will be directly targeting transparent gif by stopping the browser from displaying properly. <a title="Tomodea's Workaround on Flickr Forum" href="http://www.flickr.com/help/forum/en-us/80505/509876/" target="_blank">This workaround</a> is kindly provided by <a title="Tomodea @ Pratie.com" href="http://www.pratie.com/" target="_blank">tomodea</a>.</p>
<ol class="code">
<li><code>div#flickr img[src*="http://geo.yahoo.com"] {</code></li>
<li class="indent1"><code>display: none;</code></li>
<li><code>}</code></li>
</ol>
<p>This fix is painless and easy :) what you&#8217;re doing if you place this in your stylesheet is that you&#8217;ll be instructing the browser not to display images from http://geo.yahoo.com, which is where the transparent gif is hosted at.</p>
<p><strong>*Disadvantage of Workaround #2:</strong> If Flickr changes the image URL, you&#8217;ll have to modify the image source. More importantly, if Flickr switches the image source to a php file which randomly picks transparent gif from various place (which is unlikely unless Flickr is ought to be evil), this fix will not work.</p>
<h2>Fixed!</h2>
<div id="attachment_2380" class="wp-caption alignright" style="width: 215px"><img class="size-full wp-image-2380" title="Buggy Flickr Badge JS - Problem corrected with CSS" src="http://www.teddy-o-ted.com/wp-content/uploads/2008/09/buggyflickrbadgejs03.jpg" alt="Buggy Flickr Badge JS - Problem corrected with CSS" width="205" height="220" /><p class="wp-caption-text">Problem corrected with CSS (:</p></div>
<p>After applying any of the methods describe above, your problem will be fixed for the moment being. The screenshot to the right shows the product of the three fixes &#8211; since they basically do the same thing, there&#8217;s no point posting three separate screenshots.</p>
<p>I&#8217;ve tested the three methods on my blog in various browsers &#8211; Firefox 3, Safari 3, Opera 9 Google Chrome 0.2 and IE 7. All fixes seem to work fine, but I cannot guarantee there&#8217;s no problem for people using IE6 and below &#8211; and if you&#8217;re still using IE6, please upgrade to IE7 as it&#8217;s for free (even if you&#8217;re using a pirated copy of Windows). There&#8217;s simply no reason hanging your dear life onto IE6.</p>
<p>For the moment being, the size of the transparent gif is set to height=0px and width=0px, if you do look at the badge script. I hope the Flickr team wouldn&#8217;t mess with the dimensions or life will be hell for us :razz:</p>
<p>If you have any questions or problem with the fixes, or have any cooler CSS workarounds, feel free to post them in your comment! Thanks!</p>
<h3  class="related_post_title">Related</h3><p>Related posts that might interest you:</p><ul class="related_post"><li><a href="http://teddy-o-ted.com/blog/2009/03/24/8-javascript-solutions-to-common-css-problems/" title="8 Javascript solutions to common CSS problems">8 Javascript solutions to common CSS problems</a></li><li><a href="http://teddy-o-ted.com/blog/2006/11/17/piecing-things-together/" title="Piecing Things Together">Piecing Things Together</a></li><li><a href="http://teddy-o-ted.com/blog/2009/03/22/easy-display-switch-with-css-and-jquery/" title="Easy Display Switch with CSS and jQuery">Easy Display Switch with CSS and jQuery</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://teddy-o-ted.com/blog/2008/09/05/fix-for-buggy-flickr-badge-js/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Designing is Fun &#8211; a WordPress Poster</title>
		<link>http://teddy-o-ted.com/blog/2008/05/14/designing-is-fun-a-wordpress-poster/</link>
		<comments>http://teddy-o-ted.com/blog/2008/05/14/designing-is-fun-a-wordpress-poster/#comments</comments>
		<pubDate>Wed, 14 May 2008 09:51:05 +0000</pubDate>
		<dc:creator>Terry</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Photoshop]]></category>
		<category><![CDATA[Site]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Clipboard]]></category>
		<category><![CDATA[Copy]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Linking]]></category>
		<category><![CDATA[Modification]]></category>
		<category><![CDATA[Poster]]></category>
		<category><![CDATA[Scriptaculous]]></category>
		<category><![CDATA[Scrolling]]></category>
		<category><![CDATA[Smashing Magazine]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Typography]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.teddy-o-ted.com/?p=1966</guid>
		<description><![CDATA[Designing is indeed fun! I&#8217;ve read several Photoshop tutorials and downloaded several fonts from Smashingmagazine.com &#8211; and I subsequently realised that there&#8217;s more that just photo manipulation work that Photoshop can do! It can be an awesome substitute for Adobe Illustrator, although it lacks quite a number of illustration-specific tools, a bit of adaptation can [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-1967" title="Designing is Fun - WordPress Poster" src="http://www.teddy-o-ted.com/wp-content/uploads/2008/05/designingisfun01.jpg" alt="Designing is Fun - WordPress Poster" width="600" height="550" /></p>
<p>Designing is indeed fun! I&#8217;ve read several Photoshop tutorials and downloaded several fonts from <a title="Smashingmagazine.com" href="http://www.smashingmagazine.com/" target="_blank">Smashingmagazine.com</a> &#8211; and I subsequently realised that there&#8217;s more that just photo manipulation work that Photoshop can do! It can be an awesome substitute for Adobe Illustrator, although it lacks quite a number of illustration-specific tools, a bit of adaptation can do you lots of magic.</p>
<p>The WordPress Poster above is created using a combination of Photoshop tips and tricks from THREE separate tutorials:</p>
<ol>
<li><strong>General design (lens flare and glitter) plus the WordPress logo</strong> &#8211; <a title="Flare Effect Tutorial - DanPhilibin.com" href="http://danphilibin.com/2007/10/11/how-to-replicate-the-flare-effect-on-wpcustomizationcom/" target="_blank">Flare Effect Tutorial</a> by Dan Philibin.</li>
<li><strong>Rising sparks</strong> &#8211; <a title="Amazing Photoshop Light Effects - Abduzeedo.com" href="http://abduzeedo.com/amazing-photoshop-light-effect-10-steps" target="_blank">Amazing Photoshop Light Effects</a> by Fabio Sasso.</li>
<li><strong>Horizontal lines in the background</strong> &#8211; <a title="Lines Tutorial - Giackop.com" href="http://www.giackop.com/?p=70" target="_blank">Lines Tutorial</a> by Giacomo Coppola.</li>
</ol>
<p>I would want to thank them for sharing their tips and tricks for free and in great detail on their blogs. Thank you designers! The font I&#8217;m using in the poster is one of the <a title="40+ Excellent Freefonts for Professional Design - Smashingmagazine.com" href="http://www.smashingmagazine.com/2007/11/08/40-excellent-freefonts-for-professional-design/" target="_blank">40+ Excellent Freefonts For Professional Design</a> published at Smashingmagazine &#8211; it is called <em>Lacuna</em>, by <a title="Glashaus-design.com" href="http://www.glashaus-design.com/" target="_blank">Glashaus Design</a>.</p>
<p>In case you&#8217;re interested, I&#8217;ve also included a sample .tif file which is exactly the one I&#8217;ve used to create this poster. It&#8217;s 600*600, and is NOT SUITABLE FOR PRINT because I think I&#8217;ve set the <a title="Dots per Inch - Wikipedia.org" href="http://en.wikipedia.org/wiki/Dots_per_inch" target="_blank"><abbr title="Dots per inch">dpi</abbr></a> way too low.</p>
<p class="download download-image-tiff" title="Download link for Wordpress Poster - Sample"><a href="http://teddy-o-ted.com/download/6" title="Download link for Wordpress Poster - Sample."><span class="download-title"><strong>download</strong>: Wordpress Poster - Sample</span><span class="download-stats">Version 1.0 &#92; File size: 2.49 MB &#92; 1225 downloads</span><span class="download-desc"></span></a></p>
<h2>teddY-risatioN&trade; Delta becomes v1.1</h2>
<p>After a few days of editing and learning, I&#8217;ve made some major modifications to the current WordPress theme, <a title="teddY-risatioNâ„¢ Delta Released!" href="http://www.teddy-o-ted.com/design/teddy-risation-delta-released/">teddY-risatioN&trade; Delta</a>.</p>
<h3>Modification #1 &#8211; Footer becomes a little bigger</h3>
<p>This is one of the modifications I don&#8217;t think will be welcomed by everyone, because it&#8217;s making my footer even bulkier! I&#8217;ve decided to move the random display of Flickr photos to the footer, so as to prevent distraction from the main content. The number of tweets is also increased from the original five to the current seven, so as to prevent the footer from looking lopsided.</p>
<h3>Modification #2 &#8211; Cleaner comment form</h3>
<p>The perfectionist mindset in me has been frequently irked by the rather cluttered comment form &#8211; there is a whole bunch of comment notes and instructions between the input fields and the comment textarea. Having in mind that I&#8217;ve already installed <a title="Scriptaculous" href="http://script.aculo.us/">Scriptaculous</a> for the collapsible sidebar effect, I&#8217;ve decided to incorporate this effect to create the collapsible comment notes.</p>
<p>Simply click on the Show/Hide Comment Notes to reveal the instructions. It is set to hidden by default, so the comment form will be kept clean, neat and tidy! If you need any help to create such an effect, feel free to ask me, either through commenting or the <a title="Contact me!" href="http://www.teddy-o-ted.com/contact/">contact form</a>.</p>
<h3>Modification #3 &#8211; Auto-copy of comment to clipboard upon submission</h3>
<p>From now on, never worry about losing your comments when this blog experiences a server time-out, when your Internet connection suddenly breaks, when you accidentally hit the Back button or when my nasty Spam Karma decides that you&#8217;re talking spam instead of the real stuff.</p>
<p>Jeffrey is very nice to share his <a title="Clipboard Copy - Jeffothy.com" href="http://www.jeffothy.com/weblog/clipboard-copy/" target="_blank">copy to clipboard script</a> on his blog for free! Installing the javascript is simple &#8211; upload the .js file and the .swf file (the .swf file is for a Firefox security fix) onto your server, load the .js file in your header and you&#8217;re ready to go! I&#8217;ve added a javascript &#8216;onclick&#8217; event to the comment submit button, so everytime you submit a comment, it is automatically copied to your clipboard. You can try this feature out by pasting ([Ctrl]+[V] in Windows) it in anything (comment textarea, word document, notepad or whatever) and you&#8217;ll see your comment again :)</p>
<p>Of course, you can manually copy your comment to clipboard if you&#8217;re feeling a little unsafe. There&#8217;s a link near the comment form that allows you to do this. Since installing this script is a little complicated, I am more than happy to be able to come to your help if you need any. You can ask for help in the comments section or through the <a title="Contact me!" href="http://www.teddy-o-ted.com/contact/">contact form</a>.</p>
<h3>Modificaiton #4 &#8211; Smooth Scrolling</h3>
<p>I got this idea after realising that you can scroll smoothly through in-page links on Brandy&#8217;s blog. I did a little Google search and there&#8217;s a simple and short javascript called <a title="Smooth Scrolling javascript" href="http://www.kryogenix.org/code/browser/smoothscroll/" target="_blank">Smooth Scroll</a> that once loaded in your header, allows a smooth transition between different locations on the same page. You can try this effect out by clicking the Tagcloud link at the header navigation.</p>
<h3  class="related_post_title">Related</h3><p>Related posts that might interest you:</p><ul class="related_post"><li><a href="http://teddy-o-ted.com/blog/2009/02/15/using-zeroclipboard-for-wordpress-comments/" title="Using Zeroclipboard for Wordpress Comments">Using Zeroclipboard for Wordpress Comments</a></li><li><a href="http://teddy-o-ted.com/blog/2009/01/22/my-poster-is-finally-up/" title="My poster is finally up!">My poster is finally up!</a></li><li><a href="http://teddy-o-ted.com/blog/2008/12/01/presenting-teddy-risation-eta/" title="Presenting teddY-risatioNâ„¢ Eta">Presenting teddY-risatioNâ„¢ Eta</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://teddy-o-ted.com/blog/2008/05/14/designing-is-fun-a-wordpress-poster/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>Piecing Things Together</title>
		<link>http://teddy-o-ted.com/blog/2006/11/17/piecing-things-together/</link>
		<comments>http://teddy-o-ted.com/blog/2006/11/17/piecing-things-together/#comments</comments>
		<pubDate>Fri, 17 Nov 2006 03:58:46 +0000</pubDate>
		<dc:creator>Terry</dc:creator>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Flickr]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Myself]]></category>
		<category><![CDATA[Photos]]></category>
		<category><![CDATA[Ramblings]]></category>

		<guid isPermaLink="false">http://www.teddy-o-ted.com/?p=671</guid>
		<description><![CDATA[Actually I was tempted to make the post title &#34;Really Really Random Ramblings&#34; but I think it is redundant :D So I thought of another title&#8230; hope it sounds attractive enough to get you reading :razz: Anyway, sorry for all the ramblings these days, but when I came back to Malaysia I found so many [...]]]></description>
			<content:encoded><![CDATA[<p>Actually I was tempted to make the post title &quot;Really Really Random Ramblings&quot; but I think it is redundant :D So I thought of another title&#8230; hope it sounds attractive enough to get you reading :razz:</p>
<p>Anyway, sorry for all the ramblings these days, but when I came back to Malaysia I found so many things to be taken care of&#8230; and I once sweared that I will pay attention to small things in life since they can mean a lot to me but this is becoming a total disaster. Hope I can iron out the wrinkles soon :)</p>
<p><strong>Piece #1 &#8211; Sorry!</strong></p>
<p>I&#39;ve just realised today morning that I have not linked some of my web buddies. I am so sorry about that and I&#39;ve blogrolled / linked / <em>&quot;a href&quot;</em>ed (the HTMl geek term)&nbsp; your blogs accordingly. My brain is really slow&#8230; now then I realised I&#39;ve missed out <strong>splashmilk</strong>&#39;s and <strong>jen&#39;</strong>s blog in the blog review thing a few posts down. So remember to check the post out before it gets archived and pushed off the page! Sorry to you both!</p>
<p><strong>Piece #2 &#8211; Photos *yahoo!!!!*</strong></p>
<p>Actually these photos are taken a few days ago, and they are really random ones. So just bear with the <strong>randomness </strong>:mrgreen:&nbsp; But before we proceed let me give you a taste of my shameless self-promotion:</p>
<p><img class="centered" src="http://www.teddy-o-ted.com/images/Life/Me,%20Myslef%20&amp;%20I/thatsme.jpg" alt="That&#39;s Me!" width="400" height="533" /></p>
<div class="centered">A photo of myself in the <strong>TOILET MIRROR</strong>! (Roflmao)</div>
<p> 
<p>Sorry for the horribly large ego ;) Now let&#39;s move on.&nbsp;</p>
<p><img class="centered" src="http://www.teddy-o-ted.com/images/Life/At%20Home/rooftop.jpg" alt="Rooftop" width="400" height="300" /> </p>
<p><img class="centered" src="/images/Photos/mirror2.jpg" alt="Mirror" width="400" height="300" /></p>
<p><img class="centered" src="/images/Photos/wood1.jpg" alt="Wood" width="400" height="533" /></p>
<p><strong>Piece #3 &#8211; teddY Goes <span style="color:#3993ff">flick</span><span style="color:#ff1c92">r</span>!</strong></p>
<p><img class="alignleft" src="/images/Computing/flickr_logo.jpg" alt="Flickr" width="157" height="50" />I&#39;ve registered for a <strong><span style="color:#3993ff">flick</span><span style="color:#ff1c92">r</span></strong> account! Woot :cool:</p>
<p>I feel so good since I can share images&#8230; beyong blog boundaries! If you have some free time with you, why not try to visit <a href="http://www.flickr.com/photos/44742295@N00/">my photostream over at <strong><span style="color:#3993ff">flick</span><span style="color:#ff1c92">r</span></strong></a>? You can even see my <strong><span style="color:#3993ff">flick</span><span style="color:#ff1c92">r</span></strong> badge in the sidebar too!</p>
<p>Anyway, but <strong><span style="color:#3993ff">flick</span><span style="color:#ff1c92">r</span></strong> username is teddY-riseD (since the username teddY is taken&#8230; awww). So if you join <strong><span style="color:#3993ff">flick</span><span style="color:#ff1c92">r</span></strong> remember to add me as your contact (or just tell me and I&#39;ll add you :D).&nbsp;</p>
<p><strong>Piece #4 &#8211; Mail Me!</strong></p>
<p>So don&#39;t find anything wrong revealing my email address (which in turn reveals my true name&#8230; *uhoh*) :D</p>
<p>Gmail &#8211; terrymunweihao[at]gmail.com<br /> Hotmail &#8211; terrymunweihao[at]hotmail.com<br /> Yahoo! &#8211; terrymunweihao[at]yahoo.com</p>
<p>Lol they&#39;re almost the same. For MSN, add the Hotmail account! If you want to send me normal messages, send to the Gmail account. The Yahoo account was my first email account (wow! :o) and now I use it for my flickr!</p>
<p><strong>Piece #5 &#8211; Funky Code!</strong></p>
<p>I&#39;ve implemented this very cool funky code in my blog! But it needs to be further refined. Now it is my Alpha version ;) NOTE: Please click the &quot;Click Me!&quot; only when the page is completely loaded as only by then the script will be fully loaded and the collapsible effect will take place.</p>
<h2 class="code">Click Me!</h2>
<pre><code>This is for HTML, CSS, and JAVASCRIPT codes...
You can actually hide them!</code></pre>
<p>Have a nice day everyone!&nbsp;</p>
<h3  class="related_post_title">Related</h3><p>Related posts that might interest you:</p><ul class="related_post"><li><a href="http://teddy-o-ted.com/blog/2008/09/05/fix-for-buggy-flickr-badge-js/" title="Fix for buggy Flickr badge JS">Fix for buggy Flickr badge JS</a></li><li><a href="http://teddy-o-ted.com/blog/2008/06/15/feed-me/" title="Feed Me!">Feed Me!</a></li><li><a href="http://teddy-o-ted.com/blog/2007/09/19/its-almost-over/" title="It&#8217;s Almost Over!">It&#8217;s Almost Over!</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://teddy-o-ted.com/blog/2006/11/17/piecing-things-together/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>What&#8217;s Up?</title>
		<link>http://teddy-o-ted.com/blog/2006/11/09/whats-up-2/</link>
		<comments>http://teddy-o-ted.com/blog/2006/11/09/whats-up-2/#comments</comments>
		<pubDate>Thu, 09 Nov 2006 15:56:22 +0000</pubDate>
		<dc:creator>Terry</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Joyous]]></category>
		<category><![CDATA[Myself]]></category>
		<category><![CDATA[Site]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Template]]></category>

		<guid isPermaLink="false">http://www.teddy-o-ted.com/?p=659</guid>
		<description><![CDATA[What&#39;s up in teddY-risatioN&#8482;? Guess you have not seen any changes&#8230; but there are changes acutally! Subtle ones though :mrgreen: but I spent a great deal of time on it so&#8230; better say something good :twisted: Change #1: Blockquote Styling I&#39;ve edited the overall appearance of the text and the entire HTML element itself for [...]]]></description>
			<content:encoded><![CDATA[<p>What&#39;s up in teddY-risatioN&trade;? Guess you have not seen any changes&#8230; but there are changes acutally! Subtle ones though :mrgreen: but I spent a great deal of time on it so&#8230; better say something good :twisted:</p>
<p><strong>Change #1: Blockquote Styling</strong></p>
<p>I&#39;ve edited the overall appearance of the text and the entire HTML element itself for &lt;blockquote&gt;. Yep ;) Here is the revised edition. I&#39;ve included some really tricky javascript and css styling (of course adapted from other online sources), which took me a wholly <strong>5 hours</strong>!!!</p>
<blockquote><p>See? We have this cute little open quote on the top left hand corner, dark background to make the white text more readable. Sorry if the curves on the sides take a little more time to load (normally they load after the entire page is loaded).</p>
<p>Anyway, I&#39;ve noticed this bug. I&#39;m using PNG-24 as the image extension for the background. But it seems to be a problem displaying it correctly in internet explorer. Will try to fix it tomorrow.&nbsp;</p>
<p><strong>[EDIT] @ 12.30am</strong>: Fixed the dammmmmm bug by converting to JPEG file. That means I&#39;ll loose the transparency of the image. So next time if I want to change the background of this &lt;blockquote&gt; thing I&#39;ll have to edit the image as well. Hmph.</p>
<p><strong>[EDIT 2] @ 8.03am</strong>: Now I know why my IE doesn&#39;t show PNG transparency correctly. From <a href="http://en.wikipedia.org/wiki/PNG" target="_blank">wikipedia</a> , &quot;The fact that <u>Internet Explorer 4.0-6.0 did not support alpha-channel transparency</u> has led some people to erroneously believe that Internet Explorer does not support transparency at all. However PNGs can be given a single transparent background color, which works on IE, and is equivalent to the transparency available with GIF images.&quot; Urgh. Looks like it&#39;s time to download IE 7.0 :D </p>
</blockquote>
<p>Tell me if the dark background looks awefully ugly. You can suggest changes in the background colour by simply telling me the hex colour code (i.e. #******, where * are either numbers or alphabets). But I would rather stick to dark backgrounds so that the white text could be seen :D Sorry for HTML and CSS newbies for not fully explaning the hex colour code. Any suggestions? Esp Rames and p0p since they&#39;re professionals.</p>
<p><strong>Change #2: Post Header &amp; Title</strong></p>
<p>Changes made a few months back and I finalised the entire header today. Well, let&#39;s see. We have this cute little calendar tear out on the left hand side, then on the right hand side we have the post title followed me details. Noticed that the details include &#8211; the category which the post is filed in, the number of views (since 09/11/2006) and the number of comments (and you can click on it to take you to the comment page too!).</p>
<p><strong>Change #3: CSS Reformatted</strong></p>
<p>I&#39;ve reformatted the entire CSS file so that it doesn&#39;t look awefully cluttered. Below is the screenshot (since I believe a picture tells a thousand words) :razz: Click it to view full image.</p>
<p><a href="http://www.teddy-o-ted.com/images/Blog%20Stuff/cssreformtatted_org.jpg" target="_blank" rel="lightbox[659]"><img class="centered" src="/images/Blog%20Stuff/cssreformatted.jpg" alt="CSS Reformtatted" width="400" height="300" /></a> </p>
<p>If you have any suggestions to make on the current template please pour them out :D don&#39;t keep them to yourself. Thanks!&nbsp;</p>
<h3  class="related_post_title">Related</h3><p>Related posts that might interest you:</p><ul class="related_post"><li><a href="http://teddy-o-ted.com/blog/2008/02/15/teddy-risation%e2%84%a2-gamma-released/" title="teddY-risatioNâ„¢ Gamma Released!">teddY-risatioNâ„¢ Gamma Released!</a></li><li><a href="http://teddy-o-ted.com/blog/2007/07/06/3-years-going-strong/" title="3 Years &#038; Going Strong">3 Years &#038; Going Strong</a></li><li><a href="http://teddy-o-ted.com/blog/2009/03/24/8-javascript-solutions-to-common-css-problems/" title="8 Javascript solutions to common CSS problems">8 Javascript solutions to common CSS problems</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://teddy-o-ted.com/blog/2006/11/09/whats-up-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->