<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>David Bushell - Web Design &amp; Front-end Development</title>
	
	<link>http://dbushell.com</link>
	<description>David Bushell</description>
	<lastBuildDate>Sun, 19 Feb 2012 11:49:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/dbushell" /><feedburner:info uri="dbushell" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Designing OS’s</title>
		<link>http://feedproxy.google.com/~r/dbushell/~3/T2gtcVPJcBk/</link>
		<comments>http://dbushell.com/2012/02/19/designing-operating-systems/#comments</comments>
		<pubDate>Sun, 19 Feb 2012 11:35:53 +0000</pubDate>
		<dc:creator>David Bushell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dbushell.com/?p=4181</guid>
		<description><![CDATA[Earlier this week Apple announced OS X Mountain Lion which brings closer unity between itself and iOS for mobile. Both in user experience and—sadly—user interface. I can&#8217;t say I&#8217;m particularly excited about upgrading to OS X 10.8. The heavily stylised and textured design already looks tired on mobile apps, now we have the pleasure of [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier this week Apple announced OS X <a title="Apple - OS X Mountain Lion" href="http://www.apple.com/macosx/mountain-lion/" target="_blank">Mountain Lion</a> which brings closer unity between itself and iOS for mobile. Both in user experience and—sadly—user interface.</p>
<p>I can&#8217;t say I&#8217;m particularly excited about upgrading to OS X 10.8. The heavily stylised and textured design already looks tired on mobile apps, now we have the pleasure of it on the big screen.</p>
<p><img class="alignnone size-full wp-image-4184" title="Mac OSX - Mountain Lion" src="http://dbushell.com/wp-content/uploads/2012/02/macosx-mountain-lion.png" alt="Mac OSX - Mountain Lion" width="640" height="360" /></p>
<p>Yay.</p>
<p>Meanwhile, Microsoft blogged about <a title="Redesigning the Windows Logo" href="http://windowsteamblog.com/windows/b/bloggingwindows/archive/2012/02/17/redesigning-the-windows-logo.aspx" target="_blank">Redesigning the Windows Logo</a>, a task undertaken by <strong>Pentagram </strong>(read <a title="Pentagram - Windows 8 " href="http://pentagram.com/en/new/2012/02/new-work-microsoft.php" target="_blank">their take</a> on the logo project). Not very exciting either but it does demonstrates a huge commitment to their evolving Metro design language for which, as a whole, I&#8217;m a big fan.</p>
<p><img class="alignnone size-full wp-image-4192" title="Windows 8 Logo" src="http://dbushell.com/wp-content/uploads/2012/02/windows-8-logo.png" alt="Windows 8 Logo" width="560" height="120" /></p>
<blockquote><p>It was important that the new logo carries our Metro principle of being “Authentically Digital”. By that, we mean it does not try to emulate faux-industrial design characteristics such as materiality (glass, wood, plastic, etc.).</p></blockquote>
<p>If it wasn&#8217;t for the incredibly cheesy &#8220;Authentically Digital&#8221; line I&#8217;d say that was a deservedly accurate jab at Apple. I make no comment on how usable either system will proved to be, I only note that Microsoft find themselves in the unusual position of taking a refreshing step forward in UI design, while Apple seem hell-bent on designing themselves into a tediously well veneered corner.</p>
<h2>Regarding the Web</h2>
<p>Last year I highlighted several challenges we&#8217;ll face in <a title="Web Design 2012" href="http://dbushell.com/2011/12/15/web-design-2012-and-beyond/" target="_blank">web design for 2012</a> with a side note on why we must avoid the Apple influence and instead pay more attention to Microsoft, however untrendy that may be. I also wrote <a title="Resolution Independence" href="http://coding.smashingmagazine.com/2012/01/16/resolution-independence-with-svg/" target="_blank">Resolution Independence</a> for Smashing Magazine to primarily champion further scalable graphic usage on the web.</p>
<p>Some may argue that Apple&#8217;s design philosophy is about creating the perfect user experience across all devices. Something Metro also aims to achieve. If that were true then surely the web cannot be overlooked? Shipping hundreds of kilobytes of UI graphics is a problem. A problem that doubles in size when you consider continuing rumours of the inevitable super high-res displays. This time it&#8217;s <a title="MacRumors - Confirmed: iPad 3 Has a 2048x1536 Retina Display" href="http://www.macrumors.com/2012/02/17/confirmed-ipad-3-has-a-2048x1536-retina-display/" target="_blank">2048×1536 for the iPad 3</a>. You may have noticed how crappy raster graphics look when pixels are doubled up. We already have mobile phones that hit 300PPI. We can get away with providing high-res logos but full websites are an issue. If you&#8217;ve ever visited <a title="iCloud" href="http://www.icloud.com" target="_blank">iCloud.com</a> you&#8217;ll see what I mean. It hits 1mb per page and most of the graphics aren&#8217;t yet suitable for high-res. Bandwidth is a bottleneck that won&#8217;t go away.</p>
<p>What does all of this mean?</p>
<p>Apple do not care about the web. They&#8217;re creating a digital world in which everything is client side and native. They&#8217;ll happily make use of web technologies when it suits (<a title="iBooks Author, a nice tool but.." href="http://www.glazman.org/weblog/dotclear/index.php?post/2012/01/20/iBooks-Author-a-nice-tool-but" target="_blank">iBooks</a> for example), but the web as a platform? Not for Apple. Is that approach wrong? Not necessarily, I could not say, but it&#8217;s something us web designers need to recognise and not replicate.</p>
<p style="text-align: center;">* * *</p>
<p>Oh, and like me you were probably pissed off by John Naughton&#8217;s incredibly ill-informed <a title="Graphic designers are ruining the web" href="http://www.guardian.co.uk/technology/2012/feb/19/john-naughton-webpage-obesity" target="_blank">Graphic designers are ruining the web</a> piece in the Guardian but he does stumble around some genuine points. He just fails to articulate reasoning for either side.</p>
<img src="http://feeds.feedburner.com/~r/dbushell/~4/T2gtcVPJcBk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dbushell.com/2012/02/19/designing-operating-systems/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://dbushell.com/2012/02/19/designing-operating-systems/</feedburner:origLink></item>
		<item>
		<title>Are You Sure? The UX of Confirmations</title>
		<link>http://feedproxy.google.com/~r/dbushell/~3/5Q9IWUtQrg0/</link>
		<comments>http://dbushell.com/2012/02/13/are-you-sure-the-user-experience-of-confirmation-dialogs/#comments</comments>
		<pubDate>Mon, 13 Feb 2012 18:46:32 +0000</pubDate>
		<dc:creator>David Bushell</dc:creator>
				<category><![CDATA[Web Design & Development]]></category>

		<guid isPermaLink="false">http://dbushell.com/?p=4092</guid>
		<description><![CDATA[Imagine for a minute your web app has a &#8220;Delete&#8221; action. In HTML it takes this form: &#60;a class="delete" href="#"&#62;Delete Item&#60;/a&#62; The anchor is styled up with sexy CSS3 and functionality is implemented with an asynchronous JavaScript API call. Because we all care about accessibility (and standards) we provide a &#8220;no-JS&#8221; fallback: &#60;a class="delete" href="/item/delete/1/"&#62;Delete Item&#60;/a&#62; Lovely! [...]]]></description>
			<content:encoded><![CDATA[<p>Imagine for a minute your web app has a &#8220;Delete&#8221; action. In HTML it takes this form:</p>
<pre class="brush: html">&lt;a class="delete" href="#"&gt;Delete Item&lt;/a&gt;</pre>
<p>The anchor is styled up with sexy CSS3 and functionality is implemented with an asynchronous JavaScript API call. Because we all care about accessibility (and standards) we provide a &#8220;no-JS&#8221; fallback:</p>
<pre class="brush:html">&lt;a class="delete" href="/item/delete/1/"&gt;Delete Item&lt;/a&gt;</pre>
<p>Lovely! It&#8217;s great to build on top of what works. &#8220;Web apps&#8221; are still <em>websites</em>, after all.</p>
<p>Now, I know what you&#8217;re thinking, &#8220;Delete&#8221; is a big commitment! What if the user triggers the link accidentally? What if the user has been conditioned through years of UI exposure to expect a modal window explaining the ramifications, or at least asking for confirmation? We could write a little script (jQuery, naturally) to hijack any element with the class &#8220;delete&#8221; and throw up a confirmation box. Similar to this:</p>
<pre class="brush:js">$('a.delete').on('click', function(e) {
	return confirm('Are you sure?');
});</pre>
<p>Replace <code>confirm()</code> with your fancy dialog of choice. The function <code><a title="Mozilla MDN - window.confirm" href="https://developer.mozilla.org/en/DOM/window.confirm" target="_blank">window.confirm</a></code> provides a <strong>native</strong> dialog implemented by the browser. More on that later!</p>
<p><img title="Browser confirm dialog in Mac OSX" src="http://dbushell.com/wp-content/uploads/2012/02/macosx-confirm1.png" alt="Browser confirm dialog in Mac OSX" width="480" height="220" /></p>
<p>That&#8217;s quite nice but searching the whole DOM for links is fairly intensive. There will also be the initial delay of execution while we wait for the <code>DOMContentLoaded</code> event. Users will quick trigger fingers will be able to click &#8220;Delete&#8221; and see no confirmation request. We also have the issue of microcopy hardcoded in our script (not the best place for it). We could mess around with additional <code>data-*</code> attributes but I have a better idea&#8230;</p>
<pre class="brush:html">&lt;a class="delete" href="/message/delete/1/"
   onclick="return confirm('Are you sure?')"&gt;Delete Item&lt;/a&gt;</pre>
<p>Boom! No dependancies, no need to worry about fast fingers, and browser support dates back to <strong>Netscape</strong>. (<a title="Event Handler Attributes" href="http://www.w3.org/TR/html5/webappapis.html#event-handler-attributes" target="_blank">Event handler attributes</a> like <code>onclick</code> are still a big part of HTML5, in case you were wondering.)</p>
<p>This is perfect for our needs but as you&#8217;ve probably noticed the native confirm dialogs are ugly as hell. On mobile devices (see Android 4.0 and iOS below) the dialogs look slightly better in my opinion. More importantly though, <strong>they work!</strong> Have you ever tried building a custom modal dialog for mobile browsers? Good luck with that!</p>
<p><img class="alignnone size-full wp-image-4142" title="Browser confirm dialog on Android 4.0 and iOS" src="http://dbushell.com/wp-content/uploads/2012/02/mobile-confirm.png" alt="Browser confirm dialog on Android 4.0 and iOS" width="640" height="200" /></p>
<p><strong>Going native on mobile is undoubtedly the best experience</strong>. Even native mobile apps use native dialogs. Don&#8217;t even think about trying to implemented fixed positioning in a mobile web browser it will have you in tears (trust me). The question is: how do we go native on mobile, but provide a custom dialog design for desktop browsers like Chrome, while still gaining the benefits of inline event handlers? Check out the one I designed (based on TJ Holowaychuk&#8217;s <a title="TJ Holowaychuk's UIKit" href="http://visionmedia.github.com/uikit/" target="_blank">UIKit</a>):</p>
<p><img class="alignnone size-full wp-image-4132" title="Custom confirmation dialog" src="http://dbushell.com/wp-content/uploads/2012/02/custom-confirm.png" alt="Custom confirmation dialog" width="330" height="180" /></p>
<p>To provide both native and custom dialogs through <code>confirm()</code> we need to override the function.</p>
<p>Our problem is that the native dialog hangs the browser action in a way that we cannot. Any override we create for <code>window.confirm</code> must <code>return false</code> and then act asynchronously on later events. How can we do this when only a string is passed to the function?</p>
<p>The <code>onclick</code> attribute basically creates an event handler like this:</p>
<pre class="brush:js">function(event) {
	return confirm('Are you sure?');
}</pre>
<p>Note the <code>event</code> parameter. We need to access this object (a <a title="MouseEvent - MDN" href="https://developer.mozilla.org/en/DOM/MouseEvent" target="_blank">MouseEvent</a>) to obtain the original target element and go from there. We could pass it through like this:</p>
<pre class="brush:html">&lt;a onclick="return confirm('Are you sure?', event)"&gt;</pre>
<p>The native version of <code>confirm</code> will ignore the second argument (JavaScript isn&#8217;t fussy). But that&#8217;s not very clean, and there is a better way! When we redefine <code>confirm</code> we can actually access this event object.</p>
<pre class="brush:js;">window.nativeConfirm = window.confirm;
window.confirm = function(message) {
	var event = window.event || window.confirm.caller.arguments[0];
	// ...
};</pre>
<p>First we check the <code>window</code> object, old Internet Explorer will find an event chillin&#8217; there. Other browsers can access the function&#8217;s caller. If no event exists we just return <code>window.nativeConfirm(message);</code> and be done with it. If the event does exist — and we&#8217;ve established that the user experience will be improved with non-native dialogs — we get the target element, read the <code>href</code> attribute, pop open a custom dialog with a callback that redirects on success, and <code>return false</code> to cancel the default <code>onclick</code> action.</p>
<p>My final implementation with extended functionality looks a little something like this:</p>
<pre class="brush:html"><a onclick="return confirm('Are you sure?')" href="/action/">Delete Item</a></pre>
<pre class="brush:js">window.nativeConfirm = window.confirm;
window.confirm = function(message, event, callback)
{
	// grab the event and target element (if they exist)
	var e = event || window.event || window.confirm.caller.arguments[0];
	var el = e.target || e.srcElement;

	// go native if preferred, or no event/element
	if (useNativeConfirm() || !e || !el) {
		return window.nativeConfirm(message);
	}

	// open custom dialog with callback function
	fancyConfirm(message, function(result) {
		if (result &amp;&amp; el &amp;&amp; el['href']) {
			window.location.href = el['href'];
		}
		if (typeof callback === 'function') {
			callback(result);
		}
	});

	// cancel onclick action
	return false;
};</pre>
<p>By including <code>useNativeConfirm()</code> we can do some feature detection and browser investigation to determine what type of dialog to display. <strong>For mobile browsers this is essential.</strong> I&#8217;m still thinking about the best way to make this decision but a <a title="Modernizr media query testing" href="http://www.modernizr.com/docs/#mq" target="_blank">Modernizr media query test</a> for small screens is a good start.</p>
<p>To recap the benefits of this technique:</p>
<ul>
<li>Allows for native confirmation dialogs that are immediately present and supported by all browsers with no dependancies.</li>
<li>Is easily implemented within the HTML.</li>
<li>Has the ability to provide more attractive dialogs for browsers that can handle them while retaining native dialog use elsewhere (i.e. small screen/mobile).</li>
</ul>
<p>I&#8217;ll whip up an example soon. Any thoughts?</p>
<p>Even if you don&#8217;t like the idea of redefining <code>window.confirm</code> or using event handler attributes, I&#8217;d still recommend avoiding custom dialogs on mobile devices.</p>
<img src="http://feeds.feedburner.com/~r/dbushell/~4/5Q9IWUtQrg0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dbushell.com/2012/02/13/are-you-sure-the-user-experience-of-confirmation-dialogs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://dbushell.com/2012/02/13/are-you-sure-the-user-experience-of-confirmation-dialogs/</feedburner:origLink></item>
		<item>
		<title>Resolution Independence!</title>
		<link>http://feedproxy.google.com/~r/dbushell/~3/fIzB0gA21KY/</link>
		<comments>http://dbushell.com/2012/01/16/resolution-independence/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 19:24:51 +0000</pubDate>
		<dc:creator>David Bushell</dc:creator>
				<category><![CDATA[Web Design & Development]]></category>

		<guid isPermaLink="false">http://dbushell.com/?p=4038</guid>
		<description><![CDATA[One of my thoughts for Web Design: 2012 and Beyond concerned the issues of screen resolution and the necessity for scalable graphics on the web. As part of that thinking I&#8217;ve written a piece for Smashing Magazine entitled Resolution Independence with SVG: When we look at the breadth of Web-enabled devices, responsive design is sure to provide a [...]]]></description>
			<content:encoded><![CDATA[<p>One of my thoughts for <a title="Web Design: 2012 and Beyond" href="http://dbushell.com/2011/12/15/web-design-2012-and-beyond/" target="_blank">Web Design: 2012 and Beyond</a> concerned the issues of <strong>screen resolution</strong> and the necessity for <strong>scalable graphics</strong> on the web. As part of that thinking I&#8217;ve written a piece for Smashing Magazine entitled <a title="Resolution Independence With SVG" href="http://coding.smashingmagazine.com/2012/01/16/resolution-independence-with-svg/" target="_blank">Resolution Independence with SVG</a>:</p>
<blockquote><p>When we look at the breadth of Web-enabled devices, responsive design is sure to provide a better user experience. Scrolling horizontally, panning and zooming the viewport have their place in user interface design, but forcing the user to do these things just to navigate a website quickly becomes tedious. Fitting the website to the viewport is about more than just layout: it’s also about resolution. In this article, I’ll demonstrate why SVG is a perfect addition to future-friendly Web development.</p></blockquote>
<p>I go on to demonstrate how SVG can be used in place of normal image techniques. I first experimented with <a title="Using SVG logos" href="http://dbushell.com/2010/06/30/using-svg-logos/" target="_blank">using SVG logos</a> in 2010 but browser support was very limiting back then. Towards the end of 2011 I had <a title="The Good, the Bad, and the Logo" href="http://dbushell.com/2011/11/11/the-good-the-bad-and-the-logo/" target="_blank">another look at SVG logos</a> and was surprised by the progress — that lead to this article!</p>
<p>Of course, I&#8217;m not the only one considering these challenges. It&#8217;s great to see other designers/developers like <a title="Laura Kalbag" href="http://laurakalbag.com/" target="_blank">Laura Kalbag</a> realising the same potential (check out her site for <a title="Future Insights" href="http://futureinsightslive.com/" target="_blank">Future Insights</a> for SVG icons). I expect such practice will become common place soon. Other techniques also exist for scalable graphics, many using CSS alone (I&#8217;ve listed a few in <a title="Resolution Independence With SVG" href="http://coding.smashingmagazine.com/2012/01/16/resolution-independence-with-svg/" target="_blank">my article</a>). 300 pixel-per-inch tablets and laptops within a year or two? Make sure your websites are ready.</p>
<p><em><strong>* Update 19th Jan:</strong> I&#8217;m honoured! My article was featured in Peter Cooper&#8217;s <a title="HTML5 Weekly" href="http://html5weekly.com/archive/21.html" target="_blank">HTML Weekly</a> and received a shout out from Paul Irish in the brilliant new <a title="ShopTalk Podcast" href="http://shoptalkshow.com/episodes/002-with-paul-irish/" target="_blank">ShopTalk podcast</a>.</em></p>
<img src="http://feeds.feedburner.com/~r/dbushell/~4/fIzB0gA21KY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dbushell.com/2012/01/16/resolution-independence/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://dbushell.com/2012/01/16/resolution-independence/</feedburner:origLink></item>
		<item>
		<title>Device Optimisation</title>
		<link>http://feedproxy.google.com/~r/dbushell/~3/KNL5bb0K3fs/</link>
		<comments>http://dbushell.com/2012/01/11/device-optimisation/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 00:33:46 +0000</pubDate>
		<dc:creator>David Bushell</dc:creator>
				<category><![CDATA[Web Design & Development]]></category>

		<guid isPermaLink="false">http://dbushell.com/?p=3835</guid>
		<description><![CDATA[Device optimisation is about accessing a website on one set up and fine-tuning the experience. It could be Internet Explorer 7 on a mediocre PC, the iPhone 4000, a generic and underpowered Android tablet, or a web-enabled HD 3D TV. Whatever the set up, ask: how can I make this one experience better? The idea [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Device optimisation</strong> is about accessing a website on one set up and fine-tuning the experience. It could be Internet Explorer 7 on a mediocre PC, the iPhone 4000, a generic and underpowered Android tablet, or a web-enabled HD 3D TV. Whatever the set up, ask: <strong>how can I make this one experience better?</strong></p>
<p>The idea is not to build a website that only works on one device, it&#8217;s about taking a different perspective; looking at a website from a unique angle. Only then do we uncover hidden secrets.</p>
<p>The thing is, we&#8217;re so <em>device-agnostic</em> these days we forget that real users are only using one device at a time to access our websites. So when I talk about &#8220;device optimisation&#8221; what I&#8217;m really concerning myself with is real world one-to-one, user-on-machine experiences! How perverse.</p>
<p>If we spend the whole time developing a website from bottom to top — from the foundations upwards — we forget to look at it top-down, i.e. <strong>the user&#8217;s perspective</strong>.</p>
<p>It&#8217;s impossible to design and build a website with theoretical &#8220;best practices&#8221; alone. We have to consider the nuances (read: headaches) of individual browsers and devices common today. It&#8217;s simply a mindset which occasionally uncovers UX issues we can&#8217;t ignore. And though we apply a fix for the one device that highlighted the problem, others may benefit. Even ones that haven&#8217;t been manufactured yet.</p>
<p>Consider the time and effort we spend making websites work in IE6–9. Custom stylesheets; a progressive enhancement approach. We do this to avoid issues and to test functionality in older browsers, why not take the idea further?</p>
<p>When we use the latest in snazzy devices like an iPhone to optimise its individual experience we often bring others along for the ride. Because we&#8217;re building one website (for one web) it&#8217;s easy to check for any adverse side effects in less-abled browsers (and if need be we provide a tiered experience).</p>
<p>Exploring brand new and exciting web standards and features for new devices — despite sparse support at present — should be as important as supporting old and dying devices (if not more). The laggards drop off while the new have a whole life cycle to pass through.</p>
<p>Create an accessible and semantic backbone and then build the presentation layer with a healthy dose of device optimisation. Let&#8217;s face it, how many years does a website <em>design</em> last anyway?</p>
<img src="http://feeds.feedburner.com/~r/dbushell/~4/KNL5bb0K3fs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dbushell.com/2012/01/11/device-optimisation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://dbushell.com/2012/01/11/device-optimisation/</feedburner:origLink></item>
		<item>
		<title>Responsive Tables (2)</title>
		<link>http://feedproxy.google.com/~r/dbushell/~3/SPkagNlIz50/</link>
		<comments>http://dbushell.com/2012/01/05/responsive-tables-2/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 19:53:02 +0000</pubDate>
		<dc:creator>David Bushell</dc:creator>
				<category><![CDATA[Web Design & Development]]></category>

		<guid isPermaLink="false">http://dbushell.com/?p=3936</guid>
		<description><![CDATA[My last article on responsive tables was very popular so I&#8217;ve only gone and implemented the idea that I was alluding to with horizontal scrolling! See Responsive Tables Demo (2) — in a modern browser! Webkit browsers handle both tables perfectly. Firefox &#38; Opera handle the first version. The second version plays with/abuses the flexible box [...]]]></description>
			<content:encoded><![CDATA[<p>My <a title="Responsive Tables (and a calendar demo)" href="http://dbushell.com/2012/01/04/responsive-calendar-demo/" target="_blank">last article on responsive tables</a> was very popular so I&#8217;ve only gone and implemented the idea that I was alluding to with horizontal scrolling!</p>
<p><a href="http://dbushell.com/demos/tables/rt_05-01-12.html" target="_blank"><img class="alignnone size-full wp-image-3943" title="Responsive Tables (2)" src="http://dbushell.com/wp-content/uploads/2012/01/rt_05_01_12.png" alt="Responsive Tables (2)" width="460" height="390" /></a></p>
<p>See <a title="Responsive Table Demo" href="http://dbushell.com/demos/tables/rt_05-01-12.html" target="_blank">Responsive Tables Demo (2)</a> — <strong>in a modern browser!</strong> Webkit browsers handle both tables perfectly. Firefox &amp; Opera handle the first version. The second version plays with/abuses the <a title="CSS3 Flexible Box Layout" href="http://www.w3.org/TR/css3-flexbox/" target="_blank">flexible box layout</a> and only works with a <code>-webkit-</code> prefix.</p>
<p>I&#8217;m confident with more ingenuity I can get this idea working in IE9. Please note: this is far from perfected!</p>
<p><em>* <strong>Update 10th Jan:</strong> as the comments below note this technique (as is here) won&#8217;t work on a lot of older mobile browsers. Scrolling functionality could be replicated with JavaScript (if the layout works). Feature detection would be needed to make this viable, falling back to a layout like <a title="Responsive Data Tables" href="http://css-tricks.com/responsive-data-tables/" target="_blank">Chris Coyier&#8217;s</a>.</em></p>
<p>Something to consider: once you go block, you can&#8217;t go back! Changing the display of a table and its rows &amp; cells to block level is a lot easier than re-implementing the <a title="CSS Tables" href="http://www.w3.org/TR/CSS2/tables.html" target="_blank">table model</a> with CSS. Important to note because it&#8217;s commonly advised to build responsive websites from small to large (think <a title="320 and up" href="http://www.stuffandnonsense.co.uk/projects/320andup/" target="_blank">320 and up</a>). Good advise, though not gospel. I&#8217;ve found with tables it may be better to have the larger traditional table version as default and use <code>max-width</code> media queries to scale down. Food for thought, anyway.</p>
<p>I like this concept. Usability is up for debate. Is it intuitive enough? It keeps data side-by-side and doesn&#8217;t take up a lot of space. I&#8217;m going to keep experimenting — appreciate the feedback so far!</p>
<img src="http://feeds.feedburner.com/~r/dbushell/~4/SPkagNlIz50" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dbushell.com/2012/01/05/responsive-tables-2/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://dbushell.com/2012/01/05/responsive-tables-2/</feedburner:origLink></item>
		<item>
		<title>Responsive Tables (and a calendar demo)</title>
		<link>http://feedproxy.google.com/~r/dbushell/~3/OIpgLWpVcP0/</link>
		<comments>http://dbushell.com/2012/01/04/responsive-calendar-demo/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 23:58:31 +0000</pubDate>
		<dc:creator>David Bushell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dbushell.com/?p=3887</guid>
		<description><![CDATA[*Update* see more responsive tables progress (5th Jan). A real short post for future reference! I&#8217;m experimenting with a responsive calendar design and build. See my very rough responsive calendar demo. I&#8217;ve found through trial, error, and much pondering that the idea of a responsive calendar is actually not that complex. My demo needs more considered breakpoints and design [...]]]></description>
			<content:encoded><![CDATA[<p><em><strong>*Update*</strong> see more <a title="Responsive Tables (2)" href="http://dbushell.com/2012/01/05/responsive-tables-2/" target="_blank">responsive tables</a> progress (5th Jan).</em></p>
<p>A real short post for future reference! I&#8217;m experimenting with a <strong>responsive calendar</strong> design and build. See my <em>very</em> rough <a title="Responsive Calendar — Demo #1" href="http://dbushell.com/demos/calendar/v1_03-01-12.html" target="_blank">responsive calendar demo</a>.</p>
<p>I&#8217;ve found through trial, error, and much pondering that the idea of a responsive calendar is actually not that complex. My demo needs more considered breakpoints and design tweaks but it proves the concept. I&#8217;m thinking about developing it into a fully fledged HTML &amp; CSS baseline for others to build upon.</p>
<p>I&#8217;m also looking into more traditional <a title="HTML5 spec - Tabular data" href="http://www.w3.org/TR/html5/tabular-data.html" target="_blank">tabular data</a> as that seems to be trickier to tame in responsive web design. After a lot of Googling and a few tweets with <a title="Harry Roberts on Twitter" href="http://twitter.com/csswizardry" target="_blank">Harry Roberts</a> and <a title="James Young on Twitter" href="http://twitter.com/welcomebrand" target="_blank">James Young</a> (two fellas who know their stuff) it&#8217;s become apparent that no one has really cracked responsive tables yet.</p>
<p><a title="CSS Tricks - Responsive Data Tables" href="http://css-tricks.com/responsive-data-tables/" target="_blank">Chris Coyier at CSS Tricks</a> presented a good idea in August 2011. His solution requires hard-coded content inside CSS, not good at all for many reasons. <a title="Chris Garret - Responsive Tables" href="https://github.com/chrsgrrtt/Responsive-Table" target="_blank">Chris Garret</a> has evolved the idea very recently using <code>data-*</code> attributes in HTML and the <code>content: attr(data-*)</code> technique in CSS. A great improvement but still limiting. In the end, I&#8217;m not convinced the final small-screen view of this technique is really the best solution. The ability to compare related data sets is reduced greatly. That said, I&#8217;m at a loss as to where this can be improved.</p>
<p><em>My calendar demo also hard-coded the labels &#8220;Monday&#8221; to &#8220;Sunday&#8221; within the CSS file. That&#8217;s only slightly more acceptable until you consider localisation for language support. It&#8217;s just asking for trouble later on. With more care I believe the calendar format can be nailed. I&#8217;ll keep you posted!</em></p>
<p><a title="A Responsive Design Approach for Complex, Multicolumn Data Tables" href="http://filamentgroup.com/lab/responsive_design_approach_for_complex_multicolumn_data_tables/" target="_blank">Filament Group</a> blogged a different idea in December 2011 that maintains the table appearance by reducing the columns visible. It relies on JavaScript for the <em>interactive</em> choice of visible columns (making it an acceptable use of standards), but again, only suitable for certain data. I&#8217;ve been dreaming up more outlandish uses of JavaScript to change presentation/interaction but as a baseline the visual layout, style and presentation should never require it.</p>
<p>One thing that quickly becomes obvious is that there is <strong>no single solution</strong>. The ideas above may be perfectly adequate for some cases and completely useless for others.</p>
<p>It could be said that tabular data is boring; avoid at all costs! Fair point I&#8217;d say — thinking outside the box! Or table in this instance. But then sometimes you can&#8217;t escape semantics. Why not alternate content? Hide the table and present something else, like pie chart as <a title="Responsive Pie Chart" href="http://jsbin.com/emexa4" target="_blank">Scott Jehl</a> suggested in response to Chris Coyier&#8217;s experiment. A possibility, but if you&#8217;re going with a table in the first place it&#8217;s probably the only suitable format for that quantity of data.</p>
<p>I&#8217;m beginning to think that trying to perfectly resize a table within the visible viewport is not the best idea after all. Responsive web design does not make scrolling illegal! Could the solution lie in the realm of — gasp — <em>horizontal scrolling</em>?</p>
<p>More research and experimentation required, I&#8217;ll let you know my findings! Apologies if this post is a bit scatty. It&#8217;s gone midnight and if I don&#8217;t publish now I doubt I&#8217;ll find time until 2013!</p>
<img src="http://feeds.feedburner.com/~r/dbushell/~4/OIpgLWpVcP0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dbushell.com/2012/01/04/responsive-calendar-demo/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://dbushell.com/2012/01/04/responsive-calendar-demo/</feedburner:origLink></item>
		<item>
		<title>Web Design: 2012 and Beyond</title>
		<link>http://feedproxy.google.com/~r/dbushell/~3/ECLRyaRecmY/</link>
		<comments>http://dbushell.com/2011/12/15/web-design-2012-and-beyond/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 00:11:13 +0000</pubDate>
		<dc:creator>David Bushell</dc:creator>
				<category><![CDATA[Web Design & Development]]></category>

		<guid isPermaLink="false">http://dbushell.com/?p=3632</guid>
		<description><![CDATA[The year is ending, I guess it&#8217;s time to look forward? 2011 has been the best year of my career so far. I left my previous job to join Browser, an unexpected but excellent move! I&#8217;ve been refining my front-end development skills and design process. Next year we&#8217;ll have big websites to launch that I plan to showcase [...]]]></description>
			<content:encoded><![CDATA[<p>The year is ending, I guess it&#8217;s time to look forward?</p>
<p>2011 has been the best year of my career so far. I left my previous job to join <a title="Browser Creative" href="http://www.browsercreative.com/" target="_blank">Browser</a>, an unexpected but excellent move! I&#8217;ve been refining my front-end development skills and design process. Next year we&#8217;ll have big websites to launch that I plan to showcase here. For now, a few thoughts on the future of web design.</p>
<p>Three ideas I suspect will be hot (or hotter) topics in the coming months:</p>
<h3>1. Website Accessibility</h3>
<p><strong></strong>I&#8217;m not just talking about support for varying disabilities — or the proverbial screen reader, as important as that is — I&#8217;m talking about access for <em>all</em> users. We&#8217;re seeing ever maturing practices in device-agnostic website development. Why? Because web access is hugely diverse in users, devices and browsers. A website cannot be a fixed entity ignorant of that reality. <a title="A List Apart: Articles: Responsive Web Design" href="http://www.alistapart.com/articles/responsive-web-design/" target="_blank">Responsive website design</a> exploded this year alongside the <a title="LukeW | Mobile First" href="http://www.lukew.com/ff/entry.asp?933" target="_blank">mobile first</a> strategy. If those two ideas aren&#8217;t part of your process by now you&#8217;re very much behind. HTML semantics were <a title="Our Pointless Pursuit Of Semantic Value" href="http://coding.smashingmagazine.com/2011/11/11/our-pointless-pursuit-of-semantic-value/" target="_blank">challenged</a> and rightfully <a title="Pursuing Semantic Value" href="http://coding.smashingmagazine.com/2011/11/12/pursuing-semantic-value/" target="_blank">defended</a>.</p>
<p>Tech giants including <a title="Getting started with Windows Metro style app development" href="http://msdn.microsoft.com/en-us/library/windows/apps/br211386.aspx" target="_blank">Microsoft</a>, <a title="Motion and Interaction Design for HTML5" href="http://labs.adobe.com/technologies/edge/" target="_blank">Adobe</a>, <a title="HTML5 and web standards" href="http://www.apple.com/html5/" target="_blank">Apple</a> and <a title="Build the Future with HTML5" href="https://developers.facebook.com/html5/" target="_blank">Facebook</a> — all famous for their internet walled gardens — have publicly stated recognition of the web&#8217;s future in HTML5. Whether their current plans favour accessibility is debatable but considering the ubiquity of the web and its standards are gaining mainstream understanding, we&#8217;re seeing a demand from clients and users alike for web access that isn&#8217;t restricted to one device. I&#8217;ve been presenting initial design mockups to clients on various devices, big and small, for over a year now and it&#8217;s a brilliant experience. They just get it! They immediately start considering the user and what content is important (and not the logo size).</p>
<h3>2. Screen Resolution and Scalable Graphics</h3>
<p><strong></strong>Responsive design has highlighted to need for <a title="Responsive IMGs Part 3 — Future of the IMG Tag" href="http://www.cloudfour.com/responsive-imgs-part-3-future-of-the-img-tag/" target="_blank">responsive images</a> for multiple resolutions. The use of <a title="Displaying Icons with Fonts and Data- Attributes" href="http://24ways.org/2011/displaying-icons-with-fonts-and-data-attributes" target="_blank">web fonts</a> for icons has also gained popularity, though not quite with me! In my opinion <strong>SVG</strong> is a sleeping web standard that&#8217;s going to see rejuvenation soon. This year has seen cross-browser support for SVG as a source for <code>img</code> elements and the CSS <code>background-image</code> property. Scalability is vital when we have screens ranging from 3–30 inches with pixel densities between 100–300 pixels-per-inch all accessing the same site.</p>
<p>If the rumours of <a title="Apple to Launch 2880x1800 Resolution 'Retina Display' MacBook Pro in Q2 2012?" href="http://www.macrumors.com/2011/12/14/apple-to-launch-2880x1800-resolution-retina-display-macbook-pro-in-q2-2012/" target="_blank">Apple&#8217;s high res displays</a> for 2012 are true — and if it&#8217;s not next year or not Apple it&#8217;s only a matter of time — the single resolution raster graphics used on the web today are in trouble. They&#8217;re noticeably poor on high density mobile screens and that difference will only be exaggerated on the larger desktop &amp; laptop screens we&#8217;ll soon see climbing the dizzying heights of 300 PPI. CSS3 has gone a long way to provide resolution independent styles but SVG is needed for more complex icons, UI elements, logos and vector graphics elsewhere. Pixel units are a rare sight in modern web development.</p>
<h3>3. Interactivity</h3>
<p><strong></strong>We can safely say that fixed-width designs are a thing of the past. I&#8217;d also include static layouts as a hangover from the printed page paradigm yet they&#8217;re still a staple of website design. I&#8217;m not suggesting elements should be whizzing around aimlessly but touch screen interfaces are teaching us of a new way to think about accessing content. Is the page reload a thing of the past? With the <a title="Manipulating the browser history" href="https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history" target="_blank">JavaScript history object</a> we can still maintain the fundamental integrity that URLs give the web while exploring new methods of navigation and interaction. With an inevitable surge in web apps we&#8217;re in for a UI and UX treat.</p>
<p style="text-align: center;">* * *</p>
<p>From a web design perspective this raises several points to consider.</p>
<p>Even though interest for Wikipedia&#8217;s page on <a title="Skeuomorphism - Wikipedia" href="http://en.wikipedia.org/wiki/Skeuomorphism" target="_blank">skeuomorphism</a> has spiked in the designer demographic recently it may not be wise to follow Apple&#8217;s native app style for web design influence. It suits single minded apps, not multifaceted websites. One device, not many.</p>
<p>I&#8217;m fascinated by the design <a title="Official Google Blog: The next stage in our redesign" href="http://googleblog.blogspot.com/2011/11/next-stage-in-our-redesign.html" target="_blank">Google</a> has found new passion and respect for this year (I even replaced my iPhone with a Galaxy Nexus). Even Microsoft — <em>Microsoft!</em> — are looking innovative in this space. Have a play with the <a title="Windows Phone Demo" href="http://m.microsoft.com/windowsphone/en-us/demo/index.html" target="_blank">Windows Phone demo</a> (that&#8217;s one for front-end devs to dissect).</p>
<p>Why are Google and Microsoft taking such a different direction in UI design compared to Apple? They&#8217;re designing for <strong>multiple experiences</strong> with vast differences. That&#8217;s the challenge we face on the web and they are two players we should be keeping a very close eye on. Microsoft&#8217;s Metro style for example will span across a magnitude of phones and tablets, not to mention their Windows 8 desktop and TVs via the Xbox.</p>
<p>All of these realities require a more thoughtful approach to website development too.</p>
<p>Every year we see stories about the average <a title="Web pages are getting more bloated, and here’s why" href="http://royal.pingdom.com/2011/11/21/web-pages-getting-bloated-here-is-why/" target="_blank">website size increasing</a>. I have no doubt you&#8217;ve witnessed and contributed to that growth, I have! Content is becoming richer, constantly testing bandwidth limitations. There&#8217;s no surprised well structured <a title="Best CSS practices are killing us" href="http://www.netmagazine.com/news/best-css-practices-are-killing-us-111641" target="_blank">CSS</a> and efficient JavaScript (and <a title="Your jQuery: Now With 67% Less Suck" href="http://24ways.org/2011/your-jquery-now-with-less-suck" target="_blank">jQuery</a>) has been a theme lately. This is another reason why visual design must be content-focused.</p>
<p>On a final note: this week I released a preview of <strong><a title="Socialite.js" href="http://socialitejs.com" target="_blank">Socialite.js</a></strong> (much more useful than my banter <a title="Print.css" href="http://printstylesheet.com/" target="_blank">print stylesheet</a>). Socialite.js is a tiny script that significantly defers the loading of social sharing buttons like &#8216;Tweet&#8217;, &#8216;Like&#8217; and &#8216;+1&#8242;. There&#8217;s no point going through all the effort of optimisation only to let a &#8216;Like&#8217; button delay your entire page by seconds! Read my <a title="Socialite.js Preview" href="http://dbushell.com/2011/12/08/socialite-js-preview/" target="_blank">preview article</a> and expect a production release soon.</p>
<p>See you in January!</p>
<img src="http://feeds.feedburner.com/~r/dbushell/~4/ECLRyaRecmY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dbushell.com/2011/12/15/web-design-2012-and-beyond/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://dbushell.com/2011/12/15/web-design-2012-and-beyond/</feedburner:origLink></item>
		<item>
		<title>Socialite.js Preview</title>
		<link>http://feedproxy.google.com/~r/dbushell/~3/rvd5KEt1Ms8/</link>
		<comments>http://dbushell.com/2011/12/08/socialite-js-preview/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 13:14:28 +0000</pubDate>
		<dc:creator>David Bushell</dc:creator>
				<category><![CDATA[Web Design & Development]]></category>

		<guid isPermaLink="false">http://dbushell.com/?p=3588</guid>
		<description><![CDATA[You&#8217;ve all seen social sharing buttons. Twitter&#8217;s &#8220;tweet&#8221;, Facebook&#8217;s &#8220;like&#8221; etc. Here&#8217;s a screenshot from a popular blog to refresh your memory: They have their place on a website if used intelligently — that&#8217;s a big if! They&#8217;re difficult to design around and a nightmare for front-end development. The copy-and-paste code for each button includes a [...]]]></description>
			<content:encoded><![CDATA[<p>You&#8217;ve all seen social sharing buttons. Twitter&#8217;s &#8220;tweet&#8221;, Facebook&#8217;s &#8220;like&#8221; etc.</p>
<p>Here&#8217;s a screenshot from a popular blog to refresh your memory:</p>
<p><img class="alignnone size-full wp-image-3610" title="Social Sharing Buttons" src="http://dbushell.com/wp-content/uploads/2011/12/Screen-shot-2011-12-05-at-09.31.42.png" alt="Social Sharing Buttons" width="383" height="90" /></p>
<p>They have their place on a website if used intelligently — that&#8217;s a big <em>if</em>! They&#8217;re difficult to design around and a nightmare for front-end development.</p>
<p>The <em>copy-and-paste</em> code for each button includes a default element and a <code>&lt;script&gt;</code>. On the <code>DOMContentLoaded</code> event the <code>&lt;script&gt;</code> replaces all instances of the default element with an <code>&lt;iframe&gt;</code> — a portal into the sharing shrine of the respective social network.</p>
<p>Many people paste both element and <code>&lt;script&gt;</code> together where the button sits on the page. This is wrong! It&#8217;s best practice to move the <code>&lt;script&gt;</code> to document&#8217;s end; before the closing <code>&lt;/body&gt;</code> — <strong>you only need it once</strong>. The first script activates all button instances on the page, the second bails immediately. Neither will run until the end of the document when the event fires. No point requesting it early.</p>
<p>These <code>&lt;script&gt;</code>s and subsequent <code>&lt;iframe&gt;</code>s are massive! They request a boat load of resources that get mixed in with everything else still trying to load. Not good at all.</p>
<p>Here are the issues with sharing buttons:</p>
<ul>
<li>Their activation scripts run on the <code>DOMContentLoaded</code> and download a mass of resources.</li>
<li>They all have different defaults, most of which are inaccessible and empty elements.</li>
<li>It&#8217;s not easy to implement multiple instances and very difficult to activate new buttons after load.</li>
</ul>
<p>I&#8217;ve had enough!</p>
<p>I&#8217;ve been developing a website that runs head first into all of this nonsense. It&#8217;s a responsive design that only displays global sharing buttons on larger screens. Simply hiding them with CSS is not good enough, the browser shouldn&#8217;t download them at all. I&#8217;m also loading in JSON content to display items in a modal window for easy browsing. The items are prime for sharing but activating new buttons is a real pain.</p>
<p>I&#8217;m fed up of seeing websites hang while these gems are downloading. That experience sucks.</p>
<p>I&#8217;ve written a solution:</p>
<h2>Previewing Socialite.js</h2>
<p><a title="Socialite.js" href="http://socialitejs.com" target="_blank">Socialite.js</a> handles the activation of sharing buttons for you. All you need to do is write the default element any way you care and then activate it with Socialite, any time you wish!</p>
<p>The basic implementation looks like this:</p>
<pre class="brush:xml">&lt;a class="socialite twitter" href="http://twitter.com/share" data-url="http://socialitejs.com" data-via="dbushell"&gt;
Share on Twitter
&lt;/a&gt;</pre>
<p>At the end of your document include <code>&lt;script src="socialite.js"&gt;&lt;/script&gt;</code> and in further scripts — when you&#8217;re ready — activate buttons like so:</p>
<pre class="brush:js">Socialite.load();</pre>
<p>Or be more specific with a context:</p>
<pre class="brush:js">Socialite.load(document.getElementById('social-buttons'));</pre>
<p>Or activate a single button directly:</p>
<pre class="brush:js">Socialite.activate(document.getElementById('like-button'), 'facebook');</pre>
<p>If you&#8217;re using JavaScript elsewhere (I&#8217;m guessing jQuery?) you can run <code>Socialite.load</code> at the end of your <code>$(document).ready()</code> function, or after any event. On &#8220;ready&#8221; may still start downloading button resources while your page resources are coming in. You could activate buttons on article hover like <a title="TechCrunch" href="http://techcrunch.com/" target="_blank">TechCrunch</a> (which has a very primitive implementation of what Socialite does).</p>
<p>The added benefit of this script is that you can provide more accessible defaults for each button. So instead of Facebook&#8217;s empty <code>&lt;div&gt;</code>, or LinkedIn&#8217;s empty <code>&lt;script&gt;</code>, you can have a friendly link to the alternate sharing URLs. Socialite maps all <code>data-*</code> attributes to the corresponding customisation properties each button provides (I aim to normalise that soon).</p>
<p>Learn more at <a title="Socialite.js" href="http://socialitejs.com" target="_blank">Socialitejs.com</a> and grab the code at <a title="Socialite - GitHub" href="https://github.com/dbushell/Socialite" target="_blank">GitHub</a>.</p>
<p>Socialite is still in development but the basic implementation is working so you should be safe to give it a test drive. A final &#8220;version 1&#8243; will be released soon.</p>
<p>Please let me know your experiences!</p>
<img src="http://feeds.feedburner.com/~r/dbushell/~4/rvd5KEt1Ms8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dbushell.com/2011/12/08/socialite-js-preview/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://dbushell.com/2011/12/08/socialite-js-preview/</feedburner:origLink></item>
		<item>
		<title>Window Resize in JS</title>
		<link>http://feedproxy.google.com/~r/dbushell/~3/Wt-cDohNz1k/</link>
		<comments>http://dbushell.com/2011/11/24/window-resize-in-javascript/#comments</comments>
		<pubDate>Thu, 24 Nov 2011 22:35:53 +0000</pubDate>
		<dc:creator>David Bushell</dc:creator>
				<category><![CDATA[Web Design & Development]]></category>

		<guid isPermaLink="false">http://dbushell.com/?p=3514</guid>
		<description><![CDATA[I will write a full article on responsive website design &#38; JavaScript soon, but for now here&#8217;s a quick snippet! (With a little help from jQuery, naturally.) var resizeTimeout, win = $(window); win.bind('resize', function() { if (resizeTimeout) clearTimeout(resizeTimeout); resizeTimeout = setTimeout(function() { var width = win.width(); /* do responsive stuff... */ }, 100); }); The [...]]]></description>
			<content:encoded><![CDATA[<p>I will write a full article on responsive website design &amp; JavaScript soon, but for now here&#8217;s a quick snippet! (With a little help from jQuery, naturally.)</p>
<pre class="brush: js">var resizeTimeout, win = $(window);
win.bind('resize', function()
{
	if (resizeTimeout) clearTimeout(resizeTimeout);
	resizeTimeout = setTimeout(function()
	{
		var width = win.width();
		/* do responsive stuff... */
	}, 100);
});</pre>
<p>The basic idea is that you don&#8217;t want to be hammering the window resize event because it gets fired repeatedly when a user manually resizes their browser. Instead you should use a short timeout to wait for resizing to end.</p>
<p>You may ask, why am I using JavaScript at all, surely pure CSS media queries are better? For most circumstances they are, but when you&#8217;re applying interactivity to a website, that experience can differ greatly depending on the screen size. My latest build involves a lot of Google Maps work but only for larger screens (an alternate — and default before JS kicks in — content design is presented to suit smaller screens). Loading in the whole Google Maps JavaScript library ignorant of usage is a heavy burden on bandwidth.</p>
<p>I&#8217;m using this technique to load JavaScript and other content like high-res images very late in the game. If the window never reaches the larger breakpoints no unused resources are ever wasted.</p>
<p>More soon!</p>
<img src="http://feeds.feedburner.com/~r/dbushell/~4/Wt-cDohNz1k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dbushell.com/2011/11/24/window-resize-in-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://dbushell.com/2011/11/24/window-resize-in-javascript/</feedburner:origLink></item>
		<item>
		<title>Reaction Time (2)</title>
		<link>http://feedproxy.google.com/~r/dbushell/~3/GtVoTquNhJk/</link>
		<comments>http://dbushell.com/2011/11/16/reaction-time-2/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 19:13:26 +0000</pubDate>
		<dc:creator>David Bushell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dbushell.com/?p=3438</guid>
		<description><![CDATA[A few weeks ago I wrote Reaction Time explaining the art of relative interactivity. Today I found another perfect example! I&#8217;m using a technique based on Ariel Flesler&#8217;s excellent jQuery scrollTo plugin. The plugin scrolls the document until a specific element is in view. The set up: I have several tabs on my page that update [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago I wrote <a title="Reaction Time" href="http://dbushell.com/2011/10/25/reaction-time/" target="_blank">Reaction Time</a> explaining the art of <strong>relative</strong> interactivity.</p>
<p>Today I found another perfect example!</p>
<p>I&#8217;m using a technique based on Ariel Flesler&#8217;s excellent <a title="jQuery.ScrollTo - Ariel Flesler" href="http://flesler.blogspot.com/2007/10/jqueryscrollto.html" target="_blank">jQuery scrollTo plugin</a>. The plugin scrolls the document until a specific element is in view. The set up: I have several tabs on my page that update content below them. I want to scroll to that content as a visual guide for users to indicate what has changed and to bring it center stage. It&#8217;s a fully responsive design so on small screens this interaction is very useful.</p>
<p>The simplest jQuery implementation would look like this:</p>
<pre class="brush: js;">var target = $('#target');
$(window).scrollTo(target, { duration: 500 });</pre>
<p>That will do exactly what I want, once bound to a click event — why go any further?</p>
<p>Because that&#8217;s going to suck.</p>
<p>The <strong><code>.scrollTo();</code></strong> method takes a few options but the basic ones I care about are the <em>duration</em> (milliseconds) and an <em><a title="jQuery API - Animate - Easing" href="http://api.jquery.com/animate/#easing" target="_blank">easing function</a> </em>(that &#8220;specifies the speed at which the animation progresses at different points within the animation&#8221;). I&#8217;ve chosen an <a title="jQuery Easing Plugin (version 1.3)" href="http://gsgd.co.uk/sandbox/jquery/easing/" target="_blank">ease-in-out function</a> that starts slowly and builds up pace before decelerating again, similar to how a car would travel from A–B providing there are no barriers. I assume, I don&#8217;t drive so my car analogies are a bit flaky. Just trust me, this easing effect adds a touch of class.</p>
<p>That constant 500 millisecond duration is lazy and unresponsive. The distance I need to scroll is never constant, it depends on where the user has previously scrolled to (prior to clicking a tab). The shorter the distance the quicker we should arrive at the destination.</p>
<p>Here&#8217;s a generic evolution of my JavaScript:</p>
<pre class="brush: js;">var target = $('#target');

/* get the document height and window height */
var doc_height = $(document).height();
var win_height = $(window).innerHeight();

/* bail if the whole document is visible */
if (doc_height &lt;= win_height)
	return false;

/* get the current scroll offset and target offset */
var offset = $(window).scrollTop();
var target_offset = target.offset().top;

/* calculate a positive distance between the offsets */
var distance = Math.abs(offset - target_offset);

/* if we are scrolling down and can go no further... */
if (offset &lt; target_offset) {
	var max_offset = (doc_height - win_height);
	if (target_offset &gt; max_offset)
		distance -= target_offset - max_offset;
}

/* if there is a need to scroll, wait for updates before doing so */
if (distance) {
	setTimeout(function() {
		$('html:not(:animated),body:not(:animated)').animate(
			{ scrollTop: target_offset },
			distance * 2,
			'easeInOutQuint'
		);
	}, 500);
}</pre>
<p>The <code>setTimeout</code> delay is purely for my benefit because other actions need to happen before scrolling is initiated. The magic number <strong><code>2</code></strong> is simply a multiplier to slow things down. What&#8217;s important is that the animation always starting with a duration <em>relative</em> to the distance.</p>
<p>You may ask: <strong>&#8220;What&#8217;s the point, do people really notice such subtleties?&#8221;</strong></p>
<p><strong></strong>To which I would reply: <strong>&#8220;No, but they will notice if they&#8217;re missing.&#8221;</strong></p>
<p>It&#8217;s this sort of care that I believe produces the best possible experience for all devices. Interactivity should aid the user in a way that they&#8217;re not even conscious is happening — it should <em>just work</em>. A lot of JavaScript I see on the web today is a massive distraction. I hope this post illustrates the effort needed in interactive design.</p>
<img src="http://feeds.feedburner.com/~r/dbushell/~4/GtVoTquNhJk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dbushell.com/2011/11/16/reaction-time-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://dbushell.com/2011/11/16/reaction-time-2/</feedburner:origLink></item>
	</channel>
</rss>

