<?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>Interaction Designer Craig Dennis &#187; Javascript</title>
	<atom:link href="http://craigmdennis.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://craigmdennis.com</link>
	<description>The portfolio &#38; blog for Craig Dennis, an Interaction Designer based in South East England</description>
	<lastBuildDate>Thu, 23 Feb 2012 14:05:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=468</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Graceful Degradation vs Progressive Enhancement</title>
		<link>http://craigmdennis.com/graceful-degradation-vs-progressive-enhancement/</link>
		<comments>http://craigmdennis.com/graceful-degradation-vs-progressive-enhancement/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 21:11:37 +0000</pubDate>
		<dc:creator>Craig</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Browser Compatability]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[Graceful Degredation]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Progressive Enhancement]]></category>

		<guid isPermaLink="false">http://craigmdennis.com/?p=2039</guid>
		<description><![CDATA[For years web designers have had to deal with compatibility issues across multiple browsers and for just as many years have had to accept content being displayed in slightly different ways. This is unlikely to change soon but the differences are becoming fewer and fewer. To make the most of this you need to choose... <a class="more" href="http://craigmdennis.com/graceful-degradation-vs-progressive-enhancement/">Read more &#8594;</a>]]></description>
			<content:encoded><![CDATA[<p>For years web designers have had to deal with compatibility issues across multiple browsers and for just as many years have had to accept content being displayed in slightly different ways.</p>
<p>This is unlikely to change soon but the differences are becoming fewer and fewer. To make the most of this you need to choose a browser in which to make your design / functionality work the way you want it to and then compromise fix it in Internet Explorer other browsers.</p>
<p><img class="size-medium wp-image-2041 alignleft" title="Safari Browser" src="http://uploads.craigmdennis.com/2010/04/531173_57280561-Large-420x315.jpg" alt="" width="420" height="315" /></p>
<h3>Let there be light!</h3>
<p>The main thing to realise is that all browsers are not created equal. Older browsers lack support for new technologies (CSS3 / HTML5) and render pages in sometimes odd ways. They also tend to be less forgiving with various structural models and dynamic scripting languages like JavaScript. Something often forgotten is that some users may decide to turn off features in browsers or may be impaired in a manner which affects their browsing habits.</p>
<p>Examples include:</p>
<ul>
<li>disabling JavaScript</li>
<li>disabling images</li>
<li>not using a mouse</li>
<li>using a screen reader</li>
<li>using a text-to-speech device</li>
</ul>
<p>Now while it is near impossible to include in a design every aspect that could affect the way someone experiences a website, there are things that can be done to improve the experience where possible.</p>
<h2>Graceful degradation</h2>
<blockquote><p><em>“Graceful degradation means that your Web site continues to operate even when viewed with less-than-optimal software in which advanced effects don’t work.”</em></p>
<p>– <a href="http://www.digital-web.com/articles/fluid_thinking/">Fluid Thinking</a>, by Peter-Paul Koch</p></blockquote>
<p>Graceful degradation is finally being addressed as the wrong way to approach the problem – design utilising the most advanced features of a browser and where a browser is not capable of implementing those features, a compromise needs to be made. The testing of older browsers is often done towards the end of the development cycle. More often than not this results in a less pleasing site for those using older browsers. This mainly affects IE6 which is still widely adopted throughout the corporate world. Using this approach focuses on using the latest technologies and not considering the experience for people with older browsers, disabilities or with certain functionalities disabled.</p>
<p>So how do you add bells and whistles to a site while maintaining  focus on usability and experience? The answer is in the design process. By first focusing on what ‘everyone’ will see and use, you can address the broadest issues. Bear in mind that a good experience with a site does NOT mean pretty pictures (although they can help) and a person can have a good experience on a simple site, for no other reason than being able to do what they want to do with ease and no interference.</p>
<h2>Progressive enhancement</h2>
<p>Leading on from core usability is the inclusionof  features to improve the experience for those people who are able to experience them – this is known as ‘layering’, starting with semantic  (X)HTML, wrapped in some CSS and finally some JavaScript on top.</p>
<blockquote><p><em>“Progressive enhancement uses web technologies in a layered fashion that allows everyone to access the basic content and functionality of a web page, using any browser or Internet connection, while also providing those with better bandwidth or more advanced browser software an enhanced version of the page.”</em></p>
<p>– <a href="http://en.wikipedia.org/wiki/Progressive_enhancement">Wikipedia</a></p></blockquote>
<p>There is a far more tasty explaination using an M&amp;M that defines the same point:</p>
<blockquote><p><em>“Start with your content peanut, marked up in rich, semantic (X)HTML. Coat that content with a layer of rich, creamy CSS. Finally, add JavaScript as the hard candy shell to make a wonderfully tasty treat (and keep it from melting in your hands).”</em></p>
<p>– <a href="http://www.alistapart.com/articles/understandingprogressiveenhancement/">Aaron Gustafson</a></p></blockquote>
<h3>Good for SEO too?</h3>
<p>When you write rich, semantic (X)HTML you are making life easier for search engines to index your site. It is written in a predictable, organised fashion and as such means the search-bots are more likely to pick up on any extra information as well as index it in the way it is intended. If you think about a search-bot ‘seeing’ in a similar way to a screen-reader, they generally only read text and links and with progressive enhancement you have given them both the best opportunity to get the most out of your site.</p>
<h3>In practice…</h3>
<p>It’s difficult to keep this in mind when you want to use newer technologies to make your life easier. CSS3’s rounded corner declaration or shadow facility would be great, but what happens when you meet a browser that doesn’t support it? As long as the contrast of text to background is suitable and the corners are not an integral part of the design then they will just have square boxes and normal text – something that doesn’t affect their experience too much and won’t affect the usability in any way.</p>
]]></content:encoded>
			<wfw:commentRss>http://craigmdennis.com/graceful-degradation-vs-progressive-enhancement/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>WordPress, TimThumb &amp; jQuery: Image Hover Effect</title>
		<link>http://craigmdennis.com/wordpress-timthumb-jquery-image-hover-effect/</link>
		<comments>http://craigmdennis.com/wordpress-timthumb-jquery-image-hover-effect/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 16:40:01 +0000</pubDate>
		<dc:creator>Craig</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Effect]]></category>
		<category><![CDATA[Greyscale Hover]]></category>
		<category><![CDATA[Hover]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[On-The-Fly Thumbnails]]></category>
		<category><![CDATA[Thumbnail Generation]]></category>
		<category><![CDATA[TimThumb]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://craigmdennis.com/?p=1986</guid>
		<description><![CDATA[This post is about using TimThumb to create an on-the-fly, greyscale image thumbnail of the first image in a post and use jQuery to fade in a colour version on top creating a nice effect. Let me also say that this is not in-depth and is not for beginners as I&#8217;m not going to walk... <a class="more" href="http://craigmdennis.com/wordpress-timthumb-jquery-image-hover-effect/">Read more &#8594;</a>]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-medium wp-image-2104" title="wordpress" src="http://uploads.craigmdennis.com/2010/04/wordpress-420x370.jpg" alt="" width="420" height="370" /></p>
<p>This post is about using TimThumb to create an on-the-fly, greyscale image thumbnail of the first image in a post and use jQuery to fade in a colour version on top creating a nice effect.</p>
<p>Let me also say that this is not in-depth and is not for beginners as I&#8217;m not going to walk you through each step, merely give you an overview.</p>
<p>If you want to see a demo then look at my <a href="http://craigmdennis.com/articles/">homepage</a> as I&#8217;ve used this effect there and on my search &amp; post lists. As the thumbnails are created on-the-fly and not during image upload, you can use this technique anywhere you like! Why there isn&#8217;t a plugin for this I don&#8217;t know.</p>
<p>Things you will need:</p>
<ol>
<li>TimThumb.php</li>
<li><a href="http://www.pixellica.com/web/free-wordpress-script-for-custom-post-images#more-837" target="_blank">Get the Image script</a> (includes a TimThumb.php in a package file)</li>
<li>jQuery</li>
<li>WordPress</li>
</ol>
<p>Put TimThumb.php in your theme folder in /scripts/ (create this folder if it doesn&#8217;t exist)</p>
<p>Follow <a href="http://www.pixellica.com/web/free-wordpress-script-for-custom-post-images#more-837" target="_blank">this</a> tutorial to get TimThumb and Get The Image working in wordpress. It&#8217;s as simple as copying the script to your functions.php file (or create one if you don&#8217;t have one).</p>
<p>Link to jQuery (there is a way to link to the jQuery library that comes with WordPress but I prefer to link to the one hosted on Google)</p>
<p><strong>To view all the code, simply hover over it.</strong></p>
<h3><strong>Link to jQuery</strong></h3>
<p>Add the following to your header template to link to the Google Code hosted jQuery library:</p>
<pre>&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js" type="text/javascript"&gt;&lt;/script&gt;</pre>
<h3><strong>The PHP</strong></h3>
<p>This goes in your template file</p>
<pre style="font: normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;">
<div id="_mcePaste">&lt;?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?&gt;</div>
<div id="_mcePaste" style="padding-left: 30px;">&lt;div class="home-thumb"&gt;</div>
<div id="_mcePaste" style="padding-left: 60px;">&lt;a class="post-thumb-a" href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php echo get_image(150, 306, '2'); ?&gt;&lt;/a&gt;</div>
<div id="_mcePaste" style="padding-left: 60px;">&lt;a class="post-thumb-b" href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php echo get_image(150,306,''); ?&gt;&lt;/a&gt;</div>
<div id="_mcePaste" style="padding-left: 30px;">&lt;/div&gt;</div>
<div id="_mcePaste">&lt;?php endwhile; endif; ?&gt;</div>
</pre>
<p>This should be generally familiar to WordPress people but it&#8217;s saying if there are posts, while there are posts, get the information within the post. More information can be found on the <a href="http://codex.wordpress.org/The_Loop" target="_blank">WordPress Codex about The Loop</a>. The permalink links to the url of the post (can be any link destination though) and inside the link we call the function you should have pasted into your functions file &#8211; get_image(). The arguments are &#8216;height&#8217;, &#8216;width&#8217; and &#8216;filter&#8217;. I have yet to find a list of all the filters supported by TimThumb but for this you&#8217;ll only need filter 2 &#8211; greyscale.</p>
<p>So get_image()  gets the first image in the post and crops it to the dimensions inside the callback (in this case a height of 150px and a width of 306px but you can choose any size that is smaller than the image in the post). The third number is calling a filter from TimThumb which creates a greyscale thumbnail of the image. Then we duplicate this call but remove the &#8217;2&#8242; so we get the full colour thumbnail. We do this so that we can position them one on top of the other and fade one in creating a cool transtion.</p>
<p>The class &#8216;.post-thumb-a&#8217; should be on the link containg the greyscale image &amp; the class &#8216;.post-thumb-b&#8217; goes on the link containing the colour image. This is important as &#8216;.post-thumb-a&#8217; will be placed on top to hide the colour image and will be faded out to reveal the colour image.</p>
<h3>The CSS</h3>
<p>This positions the images and title correctly</p>
<pre>.home-thumb {

<span style="white-space: pre;">	</span>overflow:hidden;

<span style="white-space: pre;">	</span>position:relative;

<span style="white-space: pre;">	</span>width:306px;

<span style="white-space: pre;">	</span>height:150px;

}

a.post-thumb-a img, a.post-thumb-b img {

<span style="white-space: pre;">	</span>position:absolute;<span style="white-space: pre;">	</span>

<span style="white-space: pre;">	</span>top:0;

<span style="white-space: pre;">	</span>left:0;

}

a.post-thumb-a img {

<span style="white-space: pre;">	</span>z-index:10;

}</pre>
<p>What the CSS does is position &#8216;post-thumb-a img&#8217; (the image inside the link) on top (z-index:10;) of post-thumb-b img. This needs to be inside a div as it uses an absolute position to make sure they are pixel perfect overlayed. Make the parent div the same height and width as the thumbnail size you specified in the get_image() callback above.</p>
<p>If you test this now, you should see the greyscale image and not the coloured on &#8212; that&#8217;s because they coloured one is hidden underneath.</p>
<h3>The Javascript</h3>
<p>This goes in the header.php template of your WordPress theme</p>
<pre>&lt;script type="text/javascript"&gt;

jQuery(document).ready(function($){

<span style="white-space: pre;">	</span>$(".home-thumb a img").hover(

<span style="white-space: pre;">		</span>function() {

<span style="white-space: pre;">			</span>$(this).stop().animate({"opacity": "0"}, 800);

<span style="white-space: pre;">			</span>},

<span style="white-space: pre;">		</span>function() {

<span style="white-space: pre;">			</span>$(this).stop().animate({"opacity": "1"}, 800);

<span style="white-space: pre;">			</span>});

});

&lt;/script&gt;</pre>
<p>The Javascript selects &#8216;.home-thumb-a img&#8217; (the greyscale image within the link, the one hiding the coloured image) and sets the opacity to &#8217;1&#8242; until the mouse hovers over it, then change the opacity to &#8217;0&#8242; over the time of 800 ms (1000 ms = 1 second) to reveal the colour image, creating a colour fading effect.</p>
<p>That&#8217;s it, you&#8217;re done. Now have a play around. I&#8217;ve added a title tag in mine.</p>
<p>If I&#8217;ve made a mistake anywhere here please let me know and I&#8217;ll make sure to change it. Any questions and I&#8217;ll be glad to help.</p>
]]></content:encoded>
			<wfw:commentRss>http://craigmdennis.com/wordpress-timthumb-jquery-image-hover-effect/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Website Design For The iPhone</title>
		<link>http://craigmdennis.com/website-design-for-the-iphone/</link>
		<comments>http://craigmdennis.com/website-design-for-the-iphone/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 21:32:07 +0000</pubDate>
		<dc:creator>Craig</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://craigmdennis.com/?p=1459</guid>
		<description><![CDATA[Recently I have been taking a course provided by the W3C on mobile best practices designed to give the participant the best ways in which to design for mobile. Topics covered are things such as graceful enhancement and graceful failure, designing specifically to allow access on various mobile browsers and adding enhancements to the site... <a class="more" href="http://craigmdennis.com/website-design-for-the-iphone/">Read more &#8594;</a>]]></description>
			<content:encoded><![CDATA[<p>Recently I have been taking a course provided by the W3C on mobile best practices designed to give the participant the best ways in which to design for mobile.</p>
<p><img class="alignnone size-full wp-image-1561" title="iPhone" src="http://uploads.craigmdennis.com/2009/11/iphone.jpg" alt="iPhone" width="538" height="200" /></p>
<p>Topics covered are things such as graceful enhancement and graceful failure, designing specifically to allow access on various mobile browsers and adding enhancements to the site to improve user experience on the desktop browser or to allow them to fail gracefully so as still accessible on the mobile platform.</p>
<p>Doing this has inspired me to design a mobile specific version of my own website. Now while I would (ideally) like to create a version that is designed for all mobile platforms, I think I will start with just the iPhone.</p>
<p>Step one is already complete! Which is to say I have set up craigmdennis.com/iPhone/. Really tricky stuff&#8230;<span id="more-1459"></span></p>
<p>The next step is to set up some kind of automatic detection and redirection to make sure if people using an iPhone access my site, they get taken to the iPhone specific version.</p>
<p>There are several tricks and treats (pardon the Halloween pun) available when designing a site for the iPhone that allows for the use of certain javascript functions to make use of the touch screen and the orientation detection. Something that means you can even show completely different content when the orientation of the iPhone changes. A <a href="http://www.engageinteractive.co.uk/articles/2008/06/19/tutorial-building-a-website-for-the-iphone/" target="_blank">great tutorial from Engage Interactive</a> shows what is needed to do just that.</p>
<p>So I am designing a basic UI to navigate to the various sections of my site: <a href="http://craigmdennis.com/articles/">Portfolio</a>, <a href="http://craigmdennis.com/articles/articles/">Blog</a>, <a href="http://craigmdennis.com/photography">Photography </a>&amp; <a href="http://craigmdennis.com/articles/CV">CV</a>. I want to make sure of the iPhone style photo navigation but that will be a little later on. I can&#8217;t decide what to do for the blog section and whether to have a list of titles, titles and descriptions or just the most recent post.</p>
<p>I also have to figure out how to turn off the iPhone redirection when linking to the &#8216;normal&#8217; version of the site.</p>
]]></content:encoded>
			<wfw:commentRss>http://craigmdennis.com/website-design-for-the-iphone/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Have To Use A Mac</title>
		<link>http://craigmdennis.com/have-to-use-a-mac/</link>
		<comments>http://craigmdennis.com/have-to-use-a-mac/#comments</comments>
		<pubDate>Mon, 19 May 2008 12:30:30 +0000</pubDate>
		<dc:creator>Craig</dc:creator>
				<category><![CDATA[Uni work]]></category>
		<category><![CDATA[Collision]]></category>
		<category><![CDATA[GL]]></category>
		<category><![CDATA[Interactive Spaces]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[MaxMSP]]></category>
		<category><![CDATA[Particles]]></category>

		<guid isPermaLink="false">http://craigmdennis.com/?p=531</guid>
		<description><![CDATA[After some experimentation and direction with regard to the best way to &#8216;draw&#8217; in Max, the [GL] object library seems to be the way to go. The prototype was forced to refrash and redraw the screen by having a [metro] bang the [clear] element attached to the [lcd]. This meant that the screen flickered as... <a class="more" href="http://craigmdennis.com/have-to-use-a-mac/">Read more &#8594;</a>]]></description>
			<content:encoded><![CDATA[<p>After some experimentation and direction with regard to the best way to &#8216;draw&#8217; in Max, the [GL] object library seems to be the way to go. The prototype was forced to refrash and redraw the screen by having a [metro] bang the [clear] element attached to the [lcd]. This meant that the screen flickered as the metro banged. After a few minutes of manipulating the objects with the new [GL] rendering, the prototype instantly looked better and had no flickering.</p>
<p>The only problem so far is that the [GL] object library has an issue with the nVidia geforce 7600 and so the only option is to use a Mac to complete the tweaking and get started with some Javascript particle generation.</p>
<p>The script also has some useful insight into collision detection as the balls move when the mouse object (also a ball) moves around. This would be ueful to adapt and add some movement to the balls to get them to float around, then they would react to each other and allow a &#8216;contact point&#8217; in which to play the sounds back.</p>
<p><a href="http://uploads.craigmdennis.com/2008/05/balls.jpg"><img class="alignnone size-full wp-image-532" title="balls" src="http://uploads.craigmdennis.com/2008/05/balls.jpg" alt="" width="500" height="500" /></a><a href="http://uploads.craigmdennis.com/2008/05/java1.jpg"><img class="alignnone size-thumbnail wp-image-533" title="Java1" src="http://uploads.craigmdennis.com/2008/05/java1-263x100.jpg" alt="Javascript Code" width="263" height="100" /></a><a href="http://uploads.craigmdennis.com/2008/05/java2.jpg"><img class="alignnone size-thumbnail wp-image-534" title="java2" src="http://uploads.craigmdennis.com/2008/05/java2-95x100.jpg" alt="" width="95" height="100" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://craigmdennis.com/have-to-use-a-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

