<?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>Dave Russell</title>
	<atom:link href="http://daverussell.co.za/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://daverussell.co.za/wordpress</link>
	<description>Helping me remember and hopefully helping others at the same time.</description>
	<lastBuildDate>Thu, 14 Apr 2011 07:16:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Converting HTML to PDF using EvoPdf</title>
		<link>http://daverussell.co.za/wordpress/2011/04/14/converting-html-to-pdf-using-evopdf/</link>
		<comments>http://daverussell.co.za/wordpress/2011/04/14/converting-html-to-pdf-using-evopdf/#comments</comments>
		<pubDate>Thu, 14 Apr 2011 07:14:47 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[evopdf]]></category>
		<category><![CDATA[pdf converter]]></category>

		<guid isPermaLink="false">http://daverussell.co.za/wordpress/?p=212</guid>
		<description><![CDATA[We have been using ABCpdf to generate PDFs on the fly of the page currently being browsed. It has given us years of service, but now with the new version of our site I have had to find an alternative solution as my page body gets styled out of sight and then moved into position [...]]]></description>
			<content:encoded><![CDATA[<p>We have been using ABCpdf to generate PDFs on the fly of the page currently being browsed. It has given us years of service, but now with the new version of our site I have had to find an alternative solution as my page body gets styled out of sight and then moved into position using jquery to change the left:-2000px to left:0px;. ABCpdf ignores javascript so I am getting a lovely half generated page in the PDF output.</p>
<p><img alt="The PDF generater that speaks javascript" src="http://www.evopdf.com/images/logo.jpg" title="EvoPdf" class="alignleft" width="310" height="90" />The only product I have found out there on the interwebs that understands javascript is <a href="http://www.evopdf.com">EvoPdf</a>. I have downloaded the zip file of 52mb done the install &#8211; which by the way could not be easier: add reference to dll, copy another, and then call the following method:</p>
<div class="codesnip-container" >
<div class="csharp codesnip" style="font-family:monospace;"><span class="kw1">using</span> <span class="co3">EvoPdf.HtmlToPdf</span><span class="sy0">;</span></p>
<p><span class="kw1">private</span> <span class="kw1">void</span> ConvertURLToPDF<span class="br0">&#40;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">string</span> urlToConvert <span class="sy0">=</span> Request<span class="br0">&#91;</span><span class="st0">&quot;url&quot;</span><span class="br0">&#93;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; PdfConverter pdfConverter <span class="sy0">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> PdfConverter<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; pdfConverter.<span class="me1">LicenseKey</span> <span class="sy0">=</span> <span class="st0">&quot;xxxxxxx&quot;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; pdfConverter.<span class="me1">PdfDocumentOptions</span>.<span class="me1">PdfPageSize</span> <span class="sy0">=</span> PdfPageSize.<span class="me1">A4</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; pdfConverter.<span class="me1">PdfDocumentOptions</span>.<span class="me1">PdfCompressionLevel</span> <span class="sy0">=</span> PdfCompressionLevel.<span class="me1">Normal</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; pdfConverter.<span class="me1">PdfDocumentOptions</span>.<span class="me1">PdfPageOrientation</span> <span class="sy0">=</span> PdfPageOrientation.<span class="me1">Portrait</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; pdfConverter.<span class="me1">PdfDocumentOptions</span>.<span class="me1">LiveUrlsEnabled</span> <span class="sy0">=</span> true<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; pdfConverter.<span class="me1">JavaScriptEnabled</span> <span class="sy0">=</span> true<span class="sy0">;</span> <span class="co1">//the important bit &#8211; waits for javascript</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; pdfConverter.<span class="me1">ConversionDelay</span> <span class="sy0">=</span> <span class="nu0">10</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; pdfConverter.<span class="me1">InterruptSlowJavaScript</span> <span class="sy0">=</span> false<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; pdfConverter.<span class="me1">PdfDocumentOptions</span>.<span class="me1">JpegCompressionEnabled</span> <span class="sy0">=</span> true<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; pdfConverter.<span class="me1">PdfDocumentOptions</span>.<span class="me1">FitWidth</span> <span class="sy0">=</span> true<span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">byte</span><span class="br0">&#91;</span><span class="br0">&#93;</span> pdfBytes <span class="sy0">=</span> pdfConverter.<span class="me1">GetPdfBytesFromUrl</span><span class="br0">&#40;</span>urlToConvert<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw5">System.<span class="me1">Web</span></span>.<span class="me1">HttpResponse</span> response <span class="sy0">=</span> <span class="kw5">System.<span class="me1">Web</span></span>.<span class="me1">HttpContext</span>.<span class="me1">Current</span>.<span class="me1">Response</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; response.<span class="me1">Clear</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; response.<span class="me1">AddHeader</span><span class="br0">&#40;</span><span class="st0">&quot;Content-Type&quot;</span>, <span class="st0">&quot;application/pdf&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; response.<span class="me1">AddHeader</span><span class="br0">&#40;</span><span class="st0">&quot;Content-Disposition&quot;</span>, <span class="kw4">String</span>.<span class="me1">Format</span><span class="br0">&#40;</span><span class="st0">&quot;attachment; filename=Output.pdf; size={0}&quot;</span>, pdfBytes.<span class="me1">Length</span>.<span class="me1">ToString</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; response.<span class="me1">BinaryWrite</span><span class="br0">&#40;</span>pdfBytes<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; response.<span class="me1">End</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>The license is a little hefty, but you can trail the full version to see if it suits your needs before dusting off the credit card &#8211; the only thing is the outputed PDF will have a watermark over it until you get a license.</p>
]]></content:encoded>
			<wfw:commentRss>http://daverussell.co.za/wordpress/2011/04/14/converting-html-to-pdf-using-evopdf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Detect browser window focus</title>
		<link>http://daverussell.co.za/wordpress/2011/04/13/detect-browser-window-focus/</link>
		<comments>http://daverussell.co.za/wordpress/2011/04/13/detect-browser-window-focus/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 11:55:50 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[JQuery]]></category>

		<guid isPermaLink="false">http://daverussell.co.za/wordpress/?p=230</guid>
		<description><![CDATA[The scenario: You have a link that creates a hidden iframe which generates a file download (a pdf of the current page in my example). You have cleverly given the user some visual feedback in the form of an animated &#8216;waiting&#8217; gif and you would like the clever animation to go away once the user [...]]]></description>
			<content:encoded><![CDATA[<p>The scenario: You have a link that creates a hidden iframe which generates a file download (a pdf of the current page in my example). You have cleverly given the user some visual feedback in the form of an animated &#8216;waiting&#8217; gif and you would like the clever animation to go away once the user has saved the file.</p>
<p>Using a javascript setTimeout is just not going to work as you don&#8217;t know how long this will take, so the logical thing is to detect when the browser window gets focus again.</p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;"><span class="kw2">function</span> <span class="kw3">onFocus</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span> $<span class="br0">&#40;</span><span class="st0">&#8216;#icon_pdf&#8217;</span><span class="br0">&#41;</span>.<span class="me1">removeClass</span><span class="br0">&#40;</span><span class="st0">&#8216;icon_pdf_waiting&#8217;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="br0">&#125;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="coMULTI">/*@cc_on!@*/</span><span class="kw2">false</span><span class="br0">&#41;</span> <span class="br0">&#123;</span> document.<span class="me1">onfocusin</span> <span class="sy0">=</span> <span class="kw3">onFocus</span><span class="sy0">;</span><span class="coMULTI">/*IE*/</span> <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span> window.<span class="kw3">onfocus</span> <span class="sy0">=</span> <span class="kw3">onFocus</span><span class="sy0">;</span> <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&#8216;#icon_pdf&#8217;</span><span class="br0">&#41;</span>.<span class="me1">click</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">addClass</span><span class="br0">&#40;</span><span class="st0">&#8216;icon_pdf_waiting&#8217;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&#8216;iframe#pdfFrame&#8217;</span><span class="br0">&#41;</span>.<span class="me1">remove</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span>document.<span class="me1">body</span><span class="br0">&#41;</span>.<span class="me1">append</span><span class="br0">&#40;</span><span class="st0">&#8216;&lt;IFRAME height=&quot;1&quot; width=&quot;1&quot; id=&quot;pdfFrame&quot;&gt;&lt;/IFRAME&gt;&#8217;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&#8216;iframe#pdfFrame&#8217;</span><span class="br0">&#41;</span>.<span class="me1">attr</span><span class="br0">&#40;</span><span class="st0">&#8216;src&#8217;</span><span class="sy0">,</span> <span class="st0">&#8216;/pdf/save.aspx?url=&#8217;</span> <span class="sy0">+</span> location.<span class="me1">href</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
<p>The icon_pdf_waiting class replaces the existing icon with a waiting icon, so removing the class once you finished puts the existing icon back.</p>
<p>I only needed the onfocus event, but you could also make use of the onblur if need be.</p>
]]></content:encoded>
			<wfw:commentRss>http://daverussell.co.za/wordpress/2011/04/13/detect-browser-window-focus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A truly versatile three column template</title>
		<link>http://daverussell.co.za/wordpress/2011/04/11/a-truly-versatile-three-column-template/</link>
		<comments>http://daverussell.co.za/wordpress/2011/04/11/a-truly-versatile-three-column-template/#comments</comments>
		<pubDate>Mon, 11 Apr 2011 13:30:23 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Three column layout]]></category>

		<guid isPermaLink="false">http://daverussell.co.za/wordpress/?p=226</guid>
		<description><![CDATA[There are hundreds of 3 column templates out there, so what&#8217;s one more right? Well the difference here is that this one template can handle 1,2 or 3 columns, purely dependent on the existence of the columns on the html. So, if you have a CMS system and you generate a left or right column, [...]]]></description>
			<content:encoded><![CDATA[<p>There are hundreds of 3 column templates out there, so what&#8217;s one more right? Well the difference here is that this one template can handle 1,2 or 3 columns, purely dependent on the existence of the columns on the html. So, if you have a CMS system and you generate a left or right column, then it will be rendered correctly, but if not then the content will stretch accordingly.</p>
<p>First we need some structure</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;skin&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;align rel&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;page&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;abs&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;main&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;column&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/h1.html"><span class="kw2">h1</span></a>&gt;</span>Heading<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/h1.html"><span class="kw2">h1</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;startcontent&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;content&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/p.html"><span class="kw2">p</span></a>&gt;</span>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. <span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/p.html"><span class="kw2">p</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/p.html"><span class="kw2">p</span></a>&gt;</span>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form.<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/p.html"><span class="kw2">p</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;rel&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;footer&quot;</span>&gt;&lt;<a href="http://december.com/html/4/element/p.html"><span class="kw2">p</span></a>&gt;</span>footer<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/p.html"><span class="kw2">p</span></a>&gt;&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&#8216;left&#8217;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&#8216;column abs leftcolumn&#8217;</span>&gt;&lt;<a href="http://december.com/html/4/element/h2.html"><span class="kw2">h2</span></a>&gt;</span>Left<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/h2.html"><span class="kw2">h2</span></a>&gt;&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&#8216;right&#8217;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&#8216;column abs rightcolumn&#8217;</span>&gt;&lt;<a href="http://december.com/html/4/element/h2.html"><span class="kw2">h2</span></a>&gt;</span>Right<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/h2.html"><span class="kw2">h2</span></a>&gt;&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a>&gt;</span> &nbsp;<br />
&nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a>&gt;</span><br />
&nbsp; &nbsp; <span class="sc-1">&lt;!&#8211; items that fall ouside of the page structure&#8211;&gt;</span><br />
&nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;bannerimage&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;abs&quot;</span>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;align&quot;</span>&gt;</span>banner<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a>&gt;&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a>&gt;</span></div>
</div>
<p>Some CSS (I like to include a <a href="http://meyerweb.com/eric/tools/css/reset/">reset.css</a> before this to clear out any cross browser issues)</p>
<div class="codesnip-container" >
<div class="css codesnip" style="font-family:monospace;"><span class="re1">.align</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#123;</span><span class="kw1">width</span><span class="sy0">:</span><span class="re3">1004px</span><span class="sy0">;</span>margin<span class="sy0">:</span>0 <span class="kw2">auto</span><span class="sy0">;</span><span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="re1">.rel</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#123;</span><span class="kw1">position</span><span class="sy0">:</span><span class="kw2">relative</span><span class="sy0">;</span><span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="re1">.abs</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#123;</span><span class="kw1">position</span><span class="sy0">:</span><span class="kw2">absolute</span><span class="sy0">;</span><span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="re1">.displayblock</span> &nbsp; <span class="br0">&#123;</span><span class="kw1">display</span><span class="sy0">:</span><span class="kw2">block</span><span class="sy0">;</span><span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="re0">#page</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><span class="kw1">width</span><span class="sy0">:</span><span class="re3">1004px</span><span class="sy0">;</span>top<span class="sy0">:</span><span class="re3">340px</span><span class="sy0">;</span>background-<span class="kw1">color</span><span class="sy0">:</span><span class="re0">#fff</span><span class="sy0">;</span><span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="re0">#left</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><span class="kw1">top</span><span class="sy0">:</span><span class="nu0">0</span><span class="sy0">;</span>left<span class="sy0">:</span><span class="nu0">0</span><span class="sy0">;</span>width<span class="sy0">:</span><span class="re3">220px</span><span class="sy0">;</span>background-<span class="kw1">color</span><span class="sy0">:</span><span class="re0">#eee</span><span class="sy0">;</span><span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="re0">#right</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#123;</span><span class="kw1">top</span><span class="sy0">:</span><span class="re3">0px</span><span class="sy0">;</span>left<span class="sy0">:</span><span class="re3">740px</span><span class="sy0">;</span>width<span class="sy0">:</span><span class="re3">264px</span><span class="sy0">;</span>background-<span class="kw1">color</span><span class="sy0">:</span><span class="re0">#eee</span><span class="sy0">;</span><span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="re0">#main</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><span class="kw1">margin</span><span class="sy0">:</span>0 <span class="re3">10px</span><span class="sy0">;</span>background-<span class="kw1">color</span><span class="sy0">:</span><span class="re0">#bbb</span><span class="sy0">;</span><span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="re1">.incleft</span> <span class="re0">#main</span> &nbsp;<span class="br0">&#123;</span><span class="kw1">margin-left</span><span class="sy0">:</span><span class="re3">220px</span><span class="sy0">;</span><span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="re1">.incright</span> <span class="re0">#main</span> <span class="br0">&#123;</span><span class="kw1">margin-right</span><span class="sy0">:</span><span class="re3">265px</span><span class="sy0">;</span><span class="br0">&#125;</span><br />
&nbsp; &nbsp; .<span class="kw1">content</span> &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#123;</span><span class="kw1">margin</span><span class="sy0">:</span><span class="re3">27px</span> <span class="re3">30px</span> <span class="re3">100px</span> <span class="re3">30px</span><span class="sy0">;</span><span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="re0">#bannerimage</span> &nbsp; &nbsp;<span class="br0">&#123;</span><span class="kw1">top</span><span class="sy0">:</span><span class="re3">0px</span><span class="sy0">;</span>left<span class="sy0">:</span><span class="re3">-1px</span><span class="sy0">;</span>z-index<span class="sy0">:</span>-<span class="nu0">1</span><span class="sy0">;</span>width<span class="sy0">:</span><span class="re3"><span class="nu0">100</span>%</span><span class="sy0">;</span>height<span class="sy0">:</span><span class="re3">600px</span><span class="sy0">;</span>margin<span class="sy0">:</span>0 <span class="kw2">auto</span><span class="sy0">;</span>background-<span class="kw1">color</span><span class="sy0">:</span><span class="re0">#ccc</span><span class="sy0">;</span><span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="re0">#bannerimage</span> a &nbsp;<span class="br0">&#123;</span><span class="kw1">height</span><span class="sy0">:</span><span class="re3">195px</span><span class="sy0">;</span>margin-<span class="kw1">top</span><span class="sy0">:</span><span class="re3">85px</span><span class="sy0">;</span>display<span class="sy0">:</span><span class="kw2">block</span><span class="sy0">;</span><span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="re0">#footer</span> &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><span class="kw1">width</span><span class="sy0">:</span><span class="re3">1004px</span><span class="sy0">;</span>height<span class="sy0">:</span><span class="re3">200px</span><span class="sy0">;</span>background-<span class="kw1">color</span><span class="sy0">:</span><span class="re0">#ddd</span><span class="sy0">;</span><span class="br0">&#125;</span></div>
</div>
<p>And then the javascript (remember to add the jQuery library and an optional equal heights plugin)</p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;"><span class="co1">//&#8212;Column display manager</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>$<span class="br0">&#40;</span><span class="st0">&#8216;#page .leftcolumn&#8217;</span><span class="br0">&#41;</span>.<span class="me1">length</span> <span class="sy0">&gt;</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span> $<span class="br0">&#40;</span><span class="st0">&#8216;#page&#8217;</span><span class="br0">&#41;</span>.<span class="me1">addClass</span><span class="br0">&#40;</span><span class="st0">&#8216;incleft&#8217;</span><span class="br0">&#41;</span><span class="sy0">;</span> $<span class="br0">&#40;</span><span class="st0">&#8216;#left&#8217;</span><span class="br0">&#41;</span>.<span class="me1">addClass</span><span class="br0">&#40;</span><span class="st0">&#8216;displayblock&#8217;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>$<span class="br0">&#40;</span><span class="st0">&#8216;#page .rightcolumn&#8217;</span><span class="br0">&#41;</span>.<span class="me1">length</span> <span class="sy0">&gt;</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span> $<span class="br0">&#40;</span><span class="st0">&#8216;#page&#8217;</span><span class="br0">&#41;</span>.<span class="me1">addClass</span><span class="br0">&#40;</span><span class="st0">&#8216;incright&#8217;</span><span class="br0">&#41;</span><span class="sy0">;</span> $<span class="br0">&#40;</span><span class="st0">&#8216;#right&#8217;</span><span class="br0">&#41;</span>.<span class="me1">addClass</span><span class="br0">&#40;</span><span class="st0">&#8216;displayblock&#8217;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//&#8212;Column equal heights | dependancy: jquery.equalheights.js</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>$<span class="br0">&#40;</span><span class="st0">&#8216;.column&#8217;</span><span class="br0">&#41;</span>.<span class="me1">length</span> <span class="sy0">&gt;</span> <span class="nu0">1</span><span class="br0">&#41;</span> <span class="br0">&#123;</span> $<span class="br0">&#40;</span><span class="st0">&#8216;.column&#8217;</span><span class="br0">&#41;</span>.<span class="me1">equalHeights</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="br0">&#125;</span></div>
</div>
<p>The great thing about this template is that it justs works &#8211; remove the #left div and the content takes up the first two columns, remove the #right div and the content takes up the last two columns. Take out # left and #right and, I&#8217;m sure you&#8217;ve guessed it, the content takes up all three columns.</p>
]]></content:encoded>
			<wfw:commentRss>http://daverussell.co.za/wordpress/2011/04/11/a-truly-versatile-three-column-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multi Column Lists with jQuery and CSS</title>
		<link>http://daverussell.co.za/wordpress/2011/04/11/multi-column-lists-with-jquery-and-css/</link>
		<comments>http://daverussell.co.za/wordpress/2011/04/11/multi-column-lists-with-jquery-and-css/#comments</comments>
		<pubDate>Mon, 11 Apr 2011 12:43:29 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[holy grail]]></category>
		<category><![CDATA[multi column lists]]></category>

		<guid isPermaLink="false">http://daverussell.co.za/wordpress/?p=216</guid>
		<description><![CDATA[I found myself needing to solve this problem and some googling revealed that I was not the only one. The challenge I had was how to take a long list of items and make them wrap, creating columns, newspaper style next to each other. The closest I got was from the guys at alistapart, but [...]]]></description>
			<content:encoded><![CDATA[<p>I found myself needing to solve this problem and some googling revealed that I was not the only one. The challenge I had was how to take a long list of items and make them wrap, creating columns, newspaper style next to each other. The closest I got was from the guys at <a href="http://www.alistapart.com/articles/multicolumnlists/">alistapart</a>, but still not quite what I was after.</p>
<p>So, with coffee mug charged and appropriate tunes on the ipod I set out to solve some problems. The resulting jQuery function is actually quite succinct &#8211; maybe I have left something out, but it is exactly what I need: The list is dynamic, so I never know quite how long it is going to be and I do not want children elements to be spread over multiple columns.</p>
<p>The list goes something like this</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<a href="http://december.com/html/4/element/ul.html"><span class="kw2">ul</span></a> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;test&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span>Parent<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/ul.html"><span class="kw2">ul</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span>child<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span>child<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span>child<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/ul.html"><span class="kw2">ul</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span>Parent<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/ul.html"><span class="kw2">ul</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span>child<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span>child<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span>child<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span>child<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span>child<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/ul.html"><span class="kw2">ul</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span>&#8230;</div>
</div>
<p>and the javascript something like this:</p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;">jQuery.<span class="me1">fn</span>.<span class="me1">multiColumnList</span> <span class="sy0">=</span> <span class="kw2">function</span><span class="br0">&#40;</span>settings<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; settings <span class="sy0">=</span> jQuery.<span class="me1">extend</span><span class="br0">&#40;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; width<span class="sy0">:</span> 300<span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; maxheight<span class="sy0">:</span> 400<span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; forceWidth<span class="sy0">:</span> <span class="kw2">false</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><span class="sy0">,</span> settings<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="kw2">var</span> $originallist <span class="sy0">=</span> $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="kw2">var</span> cols <span class="sy0">=</span> Math.<span class="me1">round</span><span class="br0">&#40;</span>$originallist.<span class="me1">width</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">/</span> settings.<span class="me1">width</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="kw2">var</span> colwidth <span class="sy0">=</span> Math.<span class="me1">floor</span><span class="br0">&#40;</span>$<span class="br0">&#40;</span>$originallist<span class="br0">&#41;</span>.<span class="me1">width</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">/</span> cols<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="kw2">var</span> size <span class="sy0">=</span> $<span class="br0">&#40;</span><span class="st0">&#8216;&gt;li&#8217;</span><span class="sy0">,</span> <span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">size</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="kw2">var</span> newlist <span class="sy0">=</span> <span class="st0">&quot;&quot;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="kw2">var</span> currentColumnHeight <span class="sy0">=</span> $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">find</span><span class="br0">&#40;</span><span class="st0">&quot;&gt;li&quot;</span><span class="br0">&#41;</span>.<span class="me1">eq</span><span class="br0">&#40;</span>0<span class="br0">&#41;</span>.<span class="me1">height</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="kw2">var</span> currentColumnContents <span class="sy0">=</span> <span class="st0">&#8216;&lt;li&gt;&#8217;</span> <span class="sy0">+</span> $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">find</span><span class="br0">&#40;</span><span class="st0">&quot;&gt;li&quot;</span><span class="br0">&#41;</span>.<span class="me1">eq</span><span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span>.<span class="me1">html</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">+</span> <span class="st0">&#8216;&lt;/li&gt;&#8217;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span>i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> i <span class="sy0">&lt;</span> size<span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>i <span class="sy0">+</span> 1<span class="br0">&#41;</span> <span class="sy0">&lt;</span> size<span class="br0">&#41;</span> <span class="br0">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>currentColumnHeight <span class="sy0">&lt;</span> settings.<span class="me1">maxheight</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentColumnContents <span class="sy0">=</span> currentColumnContents <span class="sy0">+</span> <span class="st0">&#8216;&lt;li&gt;&#8217;</span> <span class="sy0">+</span> $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">find</span><span class="br0">&#40;</span><span class="st0">&quot;&gt;li&quot;</span><span class="br0">&#41;</span>.<span class="me1">eq</span><span class="br0">&#40;</span>i <span class="sy0">+</span> <span class="nu0">1</span><span class="br0">&#41;</span>.<span class="me1">html</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">+</span> <span class="st0">&#8216;&lt;/li&gt;&#8217;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentColumnHeight <span class="sy0">=</span> currentColumnHeight <span class="sy0">+</span> $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">find</span><span class="br0">&#40;</span><span class="st0">&quot;&gt;li&quot;</span><span class="br0">&#41;</span>.<span class="me1">eq</span><span class="br0">&#40;</span>i <span class="sy0">+</span> 1<span class="br0">&#41;</span>.<span class="me1">height</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newlist <span class="sy0">=</span> newlist <span class="sy0">+</span> <span class="st0">&#8216;&lt;ul class=&quot;megacol&quot;&gt;&#8217;</span> <span class="sy0">+</span> currentColumnContents <span class="sy0">+</span> <span class="st0">&#8216;&lt;/ul&gt;&#8217;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentColumnContents <span class="sy0">=</span> <span class="st0">&#8216;&lt;li&gt;&#8217;</span> <span class="sy0">+</span> $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">find</span><span class="br0">&#40;</span><span class="st0">&quot;&gt;li&quot;</span><span class="br0">&#41;</span>.<span class="me1">eq</span><span class="br0">&#40;</span>i <span class="sy0">+</span> <span class="nu0">1</span><span class="br0">&#41;</span>.<span class="me1">html</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">+</span> <span class="st0">&#8216;&lt;/li&gt;&#8217;</span><span class="sy0">;</span> <span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentColumnHeight <span class="sy0">=</span> $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">find</span><span class="br0">&#40;</span><span class="st0">&quot;&gt;li&quot;</span><span class="br0">&#41;</span>.<span class="me1">eq</span><span class="br0">&#40;</span>i<span class="br0">&#41;</span>.<span class="me1">height</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; newlist <span class="sy0">=</span> newlist <span class="sy0">+</span> <span class="st0">&#8216;&lt;ul class=&quot;megacol&quot;&gt;&#8217;</span> <span class="sy0">+</span> currentColumnContents <span class="sy0">+</span> <span class="st0">&#8216;&lt;/ul&gt;&lt;br style=&quot;clear:both&quot;&gt;&#8217;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; $<span class="br0">&#40;</span>newlist<span class="br0">&#41;</span>.<span class="me1">insertBefore</span><span class="br0">&#40;</span>$originallist<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>settings.<span class="me1">forceWidth</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&#8216;ul.megacol&#8217;</span><span class="br0">&#41;</span>.<span class="me1">css</span><span class="br0">&#40;</span><span class="st0">&#8216;width&#8217;</span><span class="sy0">,</span> settings.<span class="me1">width</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; $originallist.<span class="me1">remove</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="kw1">return</span> <span class="kw1">this</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>Lastly, a sprinkling of CSS to make sure your new columns render next to each other</p>
<div class="codesnip-container" >
<div class="css codesnip" style="font-family:monospace;"><span class="re1">.megacol</span> &nbsp; &nbsp;<span class="br0">&#123;</span><span class="kw1">float</span><span class="sy0">:</span><span class="kw1">left</span><span class="sy0">;</span><span class="br0">&#125;</span></div>
</div>
<p>To make this all come together, make sure you have included the jQuery library and the function before calling it: </p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;">$<span class="br0">&#40;</span>document<span class="br0">&#41;</span>.<span class="me1">ready</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&quot;#test&quot;</span><span class="br0">&#41;</span>.<span class="me1">guidemega</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://daverussell.co.za/wordpress/2011/04/11/multi-column-lists-with-jquery-and-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting destination page to reload after back button is clicked</title>
		<link>http://daverussell.co.za/wordpress/2011/01/07/getting-destination-page-to-reload-after-back-button-is-clicked/</link>
		<comments>http://daverussell.co.za/wordpress/2011/01/07/getting-destination-page-to-reload-after-back-button-is-clicked/#comments</comments>
		<pubDate>Fri, 07 Jan 2011 09:55:21 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[back button]]></category>
		<category><![CDATA[onload]]></category>

		<guid isPermaLink="false">http://daverussell.co.za/wordpress/?p=205</guid>
		<description><![CDATA[I found that in certain cases that the back button was causing much mayhem on my site as the code is not reloaded and therefore caused some unwanted behaviour. So here&#8217;s my cross-browser fix that I have devised after much googling. For a change IE was not the challenge, but rather Firefox as the onload [...]]]></description>
			<content:encoded><![CDATA[<p>I found that in certain cases that the back button was causing much mayhem on my site as the code is not reloaded and therefore caused some unwanted behaviour.</p>
<p>So here&#8217;s my cross-browser fix that I have devised after much googling. For a change IE was not the challenge, but rather Firefox as the onload event does not fire when the back button is used. </p>
<p>First, oddly, you need to <a href="http://stackoverflow.com/questions/158319/cross-browser-onload-event-and-the-back-button">clear the unload event</a></p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<a href="http://december.com/html/4/element/body.html"><span class="kw2">body</span></a> <span class="kw3">onunload</span><span class="sy0">=</span><span class="st0">&quot;&quot;</span>&gt;</span></div>
</div>
<p>Then add a hidden field to the page to use as a flag:</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<a href="http://december.com/html/4/element/input.html"><span class="kw2">input</span></a> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;hidden&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;refreshed&quot;</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;no&quot;</span> <span class="sy0">/</span>&gt;</span></div>
</div>
<p>Lastly, the magic javascript. If you are using jQuery, don&#8217;t try and modernise the code and stick it in the .ready event &#8211; it won&#8217;t work, I tried.</p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;"><span class="kw3">onload</span> <span class="sy0">=</span> <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw2">var</span> e <span class="sy0">=</span> document.<span class="me1">getElementById</span><span class="br0">&#40;</span><span class="st0">&quot;refreshed&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>e.<span class="me1">value</span> <span class="sy0">==</span> <span class="st0">&quot;no&quot;</span><span class="br0">&#41;</span> e.<span class="me1">value</span> <span class="sy0">=</span> <span class="st0">&quot;yes&quot;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="kw1">else</span> <span class="br0">&#123;</span> e.<span class="me1">value</span> <span class="sy0">=</span> <span class="st0">&quot;no&quot;</span><span class="sy0">;</span> location.<span class="me1">reload</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>Good luck, let me know if this helped.</p>
<p>Thanks go to those who <a href="http://www.webdeveloper.com/forum/showthread.php?t=137518">contributed</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://daverussell.co.za/wordpress/2011/01/07/getting-destination-page-to-reload-after-back-button-is-clicked/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pure joy</title>
		<link>http://daverussell.co.za/wordpress/2010/10/12/pure-joy/</link>
		<comments>http://daverussell.co.za/wordpress/2010/10/12/pure-joy/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 10:07:51 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://daverussell.co.za/wordpress/?p=202</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><object width="640" height="390"><param name="movie" value="http://www.youtube.com/v/B3GribQCg6c&#038;hl=en_GB&#038;feature=player_embedded&#038;version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/B3GribQCg6c&#038;hl=en_GB&#038;feature=player_embedded&#038;version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="390"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://daverussell.co.za/wordpress/2010/10/12/pure-joy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Laser refractive surgery (Lasik)</title>
		<link>http://daverussell.co.za/wordpress/2010/05/21/laser-refractive-surgery-lasik/</link>
		<comments>http://daverussell.co.za/wordpress/2010/05/21/laser-refractive-surgery-lasik/#comments</comments>
		<pubDate>Fri, 21 May 2010 08:58:51 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Out and About]]></category>

		<guid isPermaLink="false">http://daverussell.co.za/wordpress/?p=187</guid>
		<description><![CDATA[Yesterday, after months of deliberation, investigation and hesitation I willingly allowed Dr John Hill, of the Dr Hill Eye Laser Centre, to perform laser refractive surgery (Lasik) on my less than perfect eyes which where -1.75 and astigmatic. (I say willingly because I had to sign a form just before the procedure that stated that [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignright" style="width: 286px"><img class=" " title="Old School" src="http://www.daverussell.co.za/images/glasses.jpg" alt="Do people still use these things?" width="276" height="210" /><p class="wp-caption-text">Do people still use these things?</p></div>
<p>Yesterday, after months of deliberation, investigation and hesitation I willingly allowed Dr John Hill, of the <a title="Genius" href="http://www.eyelaser.co.za/" target="_blank">Dr Hill Eye Laser Centre</a>, to perform laser refractive surgery (Lasik) on my less than perfect eyes which where -1.75 and astigmatic. (I say willingly because I had to sign a form just before the procedure that stated that I have asked all the right questions and understand what I was getting myself into. ) In less than 10 minutes both eyes had been fixed and I found myself back in the reception getting care instructions for my new eyes. I write this post less that 24 hours after the procedure and already my vision is on a par with what I had while wearing lenses.</p>
<p>Just for the record: I am an absolute girl scout and am not the bravest when it comes to needles and men in masks. I must admit I nearly fainted half way through as the thought of what was actually been done to me became a little over whelming. But honestly, the dentist is far worse and I experienced absolutely no pain. My vision was very smokey at first but but the evening was greatly improved and was even better this morning.</p>
<p>The procedure is not cheap (R15000), but having done it I would, without hesitation, recommend it to anyone.</p>
]]></content:encoded>
			<wfw:commentRss>http://daverussell.co.za/wordpress/2010/05/21/laser-refractive-surgery-lasik/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>AWB secretary-general looses the plot during interview</title>
		<link>http://daverussell.co.za/wordpress/2010/04/07/awb-secretary-general-looses-the-plot-during-interview/</link>
		<comments>http://daverussell.co.za/wordpress/2010/04/07/awb-secretary-general-looses-the-plot-during-interview/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 20:31:08 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[awb]]></category>
		<category><![CDATA[etv]]></category>
		<category><![CDATA[visagie]]></category>

		<guid isPermaLink="false">http://daverussell.co.za/wordpress/?p=185</guid>
		<description><![CDATA[Seriously? I thought we were over this.]]></description>
			<content:encoded><![CDATA[<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/0IVdrJ1zKXk&#038;hl=en_US&#038;fs=1&#038;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/0IVdrJ1zKXk&#038;hl=en_US&#038;fs=1&#038;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p>Seriously? I thought we were over this.</p>
]]></content:encoded>
			<wfw:commentRss>http://daverussell.co.za/wordpress/2010/04/07/awb-secretary-general-looses-the-plot-during-interview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unhinged: Surviving Joburg</title>
		<link>http://daverussell.co.za/wordpress/2010/03/31/unhinged-surviving-joburg/</link>
		<comments>http://daverussell.co.za/wordpress/2010/03/31/unhinged-surviving-joburg/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 05:59:39 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Out and About]]></category>

		<guid isPermaLink="false">http://daverussell.co.za/wordpress/?p=179</guid>
		<description><![CDATA[A brilliant depiction of the vibe in JHB. I grew up there, and its all true. A place that draws you in with the promise of success. A place with as many opportunities as there are dangers. Can&#8217;t wait to see it, read more here.]]></description>
			<content:encoded><![CDATA[<p><object width="480" height="295"><param name="movie" value="http://www.youtube.com/v/zbk_3D3-W04&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/zbk_3D3-W04&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="295"></embed></object></p>
<p>A brilliant depiction of the vibe in JHB. I grew up there, and its all true. A place that draws you in with the promise of success. A place with as many opportunities as there are dangers.</p>
<p>Can&#8217;t wait to see it, <a href="http://www.thebioscope.co.za/index.php/2010/03/doc-love-31-march-unhinged-surviving-joburg/">read more here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://daverussell.co.za/wordpress/2010/03/31/unhinged-surviving-joburg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fool climbs speaker stack at Kirstenbosch Goldfish concert</title>
		<link>http://daverussell.co.za/wordpress/2010/03/09/fool-climbs-speaker-stack-at-kirstenbosch-goldfish-concert/</link>
		<comments>http://daverussell.co.za/wordpress/2010/03/09/fool-climbs-speaker-stack-at-kirstenbosch-goldfish-concert/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 09:02:40 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[music]]></category>
		<category><![CDATA[Out and About]]></category>
		<category><![CDATA[goldfish]]></category>
		<category><![CDATA[kirstenbosch]]></category>
		<category><![CDATA[nutcase]]></category>

		<guid isPermaLink="false">http://daverussell.co.za/wordpress/?p=174</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/EoSEpXIDvHw&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/EoSEpXIDvHw&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://daverussell.co.za/wordpress/2010/03/09/fool-climbs-speaker-stack-at-kirstenbosch-goldfish-concert/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

