<?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>Slightlymore &#187; usability</title>
	<atom:link href="http://slightlymore.co.uk/tag/usability/feed/" rel="self" type="application/rss+xml" />
	<link>http://slightlymore.co.uk</link>
	<description>The online residence of Clinton the intertube sorcerer</description>
	<lastBuildDate>Sat, 24 Jul 2010 17:11:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0-RC2-15161</generator>
		<item>
		<title>WebAIM: Screen reader survey results</title>
		<link>http://slightlymore.co.uk/screen-reader-survey-results/</link>
		<comments>http://slightlymore.co.uk/screen-reader-survey-results/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 19:42:50 +0000</pubDate>
		<dc:creator>Clinton Montague</dc:creator>
				<category><![CDATA[Accessibility / Usability]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[External links]]></category>
		<category><![CDATA[accessibility]]></category>
		<category><![CDATA[blind]]></category>
		<category><![CDATA[screen readers]]></category>
		<category><![CDATA[survey]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://slightlymore.co.uk/?p=771</guid>
		<description><![CDATA[Web accessiblity in mind (WebAIM) have published results of their screen reader survey. While reports are often boring, they are often very useful, and this is one of those reports. Screen reader use is often forgotten during the build of a website in the jungle of SEO and the like. The report graphs things like how people browse sites (i.e. whether headings are useful), how often they find skip links and how often other usability good-practices are encountered. Give it a read and improve your web build process.]]></description>
			<content:encoded><![CDATA[<p>Web accessiblity in mind (WebAIM) have published results of their screen reader survey. While reports are often boring, they are often very useful, and this is one of those reports. Screen reader use is often forgotten during the build of a website in the jungle of SEO and the like. The report graphs things like how people browse sites (i.e. whether headings are useful), how often they find skip links and how often other usability good-practices are encountered. Give it a read and improve your web build process.</p>
]]></content:encoded>
			<wfw:commentRss>http://slightlymore.co.uk/screen-reader-survey-results/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t leave post slugs as the default</title>
		<link>http://slightlymore.co.uk/post-slug-optimisation/</link>
		<comments>http://slightlymore.co.uk/post-slug-optimisation/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 13:08:03 +0000</pubDate>
		<dc:creator>Clinton Montague</dc:creator>
				<category><![CDATA[Accessibility / Usability]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[Google / SEO]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Social Media]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[slugs]]></category>
		<category><![CDATA[textpattern]]></category>
		<category><![CDATA[uri]]></category>
		<category><![CDATA[url]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[users]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://slightlymore.co.uk/?p=664</guid>
		<description><![CDATA[This post is mainly aimed towards Wordpress, Textpattern and (probably) a multitude of other CMS driven website users. 'Smart' web software will automatically create a 'slug' for your new article, but it's not always best to trust the CMS to come up with the best URL for you.]]></description>
			<content:encoded><![CDATA[<p>This post is mainly aimed towards WordPress, Textpattern and (probably) a multitude of other CMS driven website users. &#8216;Smart&#8217; web software will automatically create a &#8216;slug&#8217; for your new article, but it&#8217;s not always best to trust the CMS to come up with the best URL for you.</p>
<p>Oh, by the way, a <em>slug</em> is a part of the URL which uniquely identifies a post in a CMS. For example, in the URL http://www.example.com/blog/my-new-post, the slug is <em>my-new-post</em></p>
<h4>The rant</h4>
<p>Take my new <a href="/fgqs"><accronym title="Frequently googled questions">FGQ</accronym></a> &#8211; <a href="http://slightlymore.co.uk/wisdom/minus-equals-operator">What does the -= operator do?</a>. Auto-slug-generators will (mostly) create the slug <em>what-does-the-operator-do</em> &#8211; which I&#8217;m sure you&#8217;ll agree is not too useful. Firstly, it would be difficult from a user&#8217;s point of view to remember which characters to remove and add in to the URL, but secondly, from an SEO point of view, it&#8217;s not terribly descriptive. Thirdly, if I then wrote an article with the title <em>what does the += operator do</em> &#8211; wordpress would create a very similar slug.</p>
<h4>The point</h4>
<p>Most, if not all, CMS systems allow you to change the slug of the post or article. Most of them also automatically create one for you. I am making the point that the automatically created slug is not always the best. When you create a new post, take a moment to think about what you&#8217;re trying to say, how people might search for it, and optimise for both. For example, this post is called <em>Don&#8217;t leave post slugs as the default</em>, but I have decided that the best way to describe it SEO-wise is <em>post-slug-optimisation</em>. It&#8217;s a minor thing, but it can make all the difference between being on the first or second page on google.</p>
]]></content:encoded>
			<wfw:commentRss>http://slightlymore.co.uk/post-slug-optimisation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>8 Tips for Maintaining a User Friendly Site in One Hour a Month</title>
		<link>http://slightlymore.co.uk/8-tips-for-maintaining-a-user-friendly-site-in-one-hour-a-month/</link>
		<comments>http://slightlymore.co.uk/8-tips-for-maintaining-a-user-friendly-site-in-one-hour-a-month/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 14:03:37 +0000</pubDate>
		<dc:creator>Clinton Montague</dc:creator>
				<category><![CDATA[Accessibility / Usability]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[External links]]></category>
		<category><![CDATA[Google / SEO]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[accessibility]]></category>
		<category><![CDATA[housework]]></category>
		<category><![CDATA[maintaining]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://slightlymore.co.uk/?p=650</guid>
		<description><![CDATA[I'm sure it's happened to you. It's always happening to me. How easy is it to build 'My awesome website' which is beautifully SEO'd, completely accessible to everyone and everything only to find that after launch, it quickly turns into 'My messy website 3.0'. It could be broken links or images, spelling mistakes or pages which somehow magically stop working. The UX Booth has written a brilliant article with suggestions as to what to check for and why it's important. And hey, an hour a month isn't <em>that</em> much time, is it.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m sure it&#8217;s happened to you. It&#8217;s always happening to me. How easy is it to build &#8216;My awesome website&#8217; which is beautifully SEO&#8217;d, completely accessible to everyone and everything only to find that after launch, it quickly turns into &#8216;My messy website 3.0&#8242;. It could be broken links or images, spelling mistakes or pages which somehow magically stop working. The UX Booth has written a brilliant article with suggestions as to what to check for and why it&#8217;s important. And hey, an hour a month isn&#8217;t <em>that</em> much time, is it.</p>
]]></content:encoded>
			<wfw:commentRss>http://slightlymore.co.uk/8-tips-for-maintaining-a-user-friendly-site-in-one-hour-a-month/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing Opera Face Gestures</title>
		<link>http://slightlymore.co.uk/introducing-opera-face-gestures/</link>
		<comments>http://slightlymore.co.uk/introducing-opera-face-gestures/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 10:00:57 +0000</pubDate>
		<dc:creator>Clinton Montague</dc:creator>
				<category><![CDATA[Accessibility / Usability]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[External links]]></category>
		<category><![CDATA[april fools]]></category>
		<category><![CDATA[joke]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://slightlymore.co.uk/?p=506</guid>
		<description><![CDATA[Opera announced today that they will be introducing face gestures into future releases of their browser to help speed up browsing. It was around 8 years ago that they introduced mouse gestures, and once again it looks like they will be revolutionising the market. Although judging by the date and time of the announcement, I wouldn't get too excited about seeing this feature any time soon ;)]]></description>
			<content:encoded><![CDATA[<p>Opera announced today that they will be introducing face gestures into future releases of their browser to help speed up browsing. It was around 8 years ago that they introduced mouse gestures, and once again it looks like they will be revolutionising the market. Although judging by the date and time of the announcement, I wouldn&#8217;t get too excited about seeing this feature any time soon ;)</p>
]]></content:encoded>
			<wfw:commentRss>http://slightlymore.co.uk/introducing-opera-face-gestures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AJAX is easy, but remember accessibility</title>
		<link>http://slightlymore.co.uk/ajax-is-easy-but-remember-accessibility/</link>
		<comments>http://slightlymore.co.uk/ajax-is-easy-but-remember-accessibility/#comments</comments>
		<pubDate>Sun, 18 Jan 2009 19:09:11 +0000</pubDate>
		<dc:creator>Clinton Montague</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Accessibility / Usability]]></category>
		<category><![CDATA[Javascript / jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Server side]]></category>
		<category><![CDATA[accessibility]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[hijax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://slightlymore.co.uk/?p=292</guid>
		<description><![CDATA[AJAX is easy. It's just javascript talking to your server to grab a little bit of content instead of the browser grabbing the whole thing. With this in mind, let's get to work and build a simple AJAX application that will work with javascript turned off. We'll do this by assuming that there is no javascript in your user's browser, then use jQuery to change the DOM to add in the behaviours.]]></description>
			<content:encoded><![CDATA[<p>AJAX is easy. It&#8217;s just javascript talking to your server to grab a little bit of content instead of the browser grabbing the whole thing. With this in mind, let&#8217;s get to work and build a simple AJAX application that will work with javascript turned off. We&#8217;ll do this by assuming that there is no javascript in your user&#8217;s browser, then use jQuery to change the DOM to add in the behaviours. </p>
<p>So first things first, I just want to lay down a few requirements for this faux-project. I want this to be properly simple, so it would be great if the regular content and AJAX content could come from the same place. I want the pages to work properly for people with no javascript. I want people with javascript to load in the new content using AJAX, but very importantly, I want them to be able to send a link to their friends or bookmark the content they are viewing. This is something which people often look over when building their AJAX applications, so normally if you send a link to someone, they&#8217;ll get the &#8216;front page&#8217; instead of the information which the sender was looking at. So let&#8217;s split the project up into four parts:</p>
<ol>
<li>Build the website using a bit of PHP magic so that either the whole page, or just the AJAX content can be loaded;</li>
<li>Use jQuery and HIJAX to update the content instead of loading the whole new page if the user has javascript enabled;</li>
<li>Create a mechanism so that people can send a link or bookmark the page;</li>
<li>and finally, load in the relevant content instead of the default content if someone uses one of their bookmarks</li>
</ol>
<h4>Part 1: The PHP</h4>
<p>For this tutorial, I&#8217;m just going to create a very simple page with just a navigation bar and content area. I will split each page up into three parts: files for the header and footer as these will be the same for all pages, and the page itself, which will <a href="http://uk.php.net/include/">include</a> the header and footer.</p>
<p>Inside the header and footer is where the magic will happen. For AJAX calls, I will pass a GET parameter to the page (I have chosen AJAX=1, but you can choose whatever you like), but normal page loads will not have this. Using this technique is a great way to test your output too &#8211; if you want the full page, just go to it&#8217;s url (i.e. http://example.com/page.php), if you want the AJAX content, stick ?AJAX=1 on the end (e.g. http://example.com/page.php?AJAX=1). </p>
<h5>header.php</h5>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'AJAX'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;html&gt;
		&lt;head&gt;
			&lt;title&gt;Example AJAX website&lt;/title&gt;
			&lt;script type=&quot;text/javascript&quot; src=&quot;/javascript/jquery.js&quot;&gt;&lt;/script&gt;
		&lt;/head&gt;
		&lt;body&gt;
			&lt;div id=&quot;navigation&quot;&gt;&lt;a href=&quot;index.php&quot;&gt;Home&lt;/a&gt; &lt;a href=&quot;page1.php&quot;&gt;Page 1&lt;/a&gt; &lt;a href=&quot;page2.php&quot;&gt;Page 2&lt;/a&gt;&lt;/div&gt;
			&lt;div id=&quot;content-area&quot;&gt;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h5>footer.php</h5>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'AJAX'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">?&gt;</span>
			&lt;/div&gt;
		&lt;/body&gt;
	&lt;/html&gt;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h5>a-page.php</h5>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">include</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'./header.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;h1&gt;Example page&lt;/h1&gt;
&lt;p&gt;My content&lt;/p&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">include</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'./footer.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<h4>Part 2: HIJAX</h4>
<p>So far the pages work for people with javascript disabled, which includes our friends, the search engines. By adding in the href to the anchors instead of just onClick handlers, the site is fully navigable and accessible to everyone. Wouldn&#8217;t it be great if we could keep this code the way it is and somehow magically get the AJAX working without modifying this at-all?! Well, the great news is that with HIJAX, we can.</p>
<p>The first thing to do is to use jQuery to find the elements which we would like to load in content via AJAX, and inject some behaviour into them. In my example, they are the anchor tags inside the navigation div. I will use jQuery to find those, add in the AJAX behaviour (which will load in the content from the same page, but with ?AJAX=1 appended) and disable them from loading in a whole new page. The next thing to do is to get them to update the address bar so that bookmarking / linking will show the correct content.</p>
<h4>Part 3: Linking mechanism</h4>
<p>If you are familiar with <a href="http://gmail.com/">Gmail</a> or <a href="http://facebook.com/">Facebook</a>, you might have noticed that when you click around, the address bar changes. They use the document&#8217;s hash to indicate what page of the site you are currently on. I like this mechanism, so I will do the same. </p>
<p>It&#8217;s quite easy really, along with the AJAX call on the onClick, we can set the <code>location.hash</code> javascript variable to be the href of the anchor tag which the user clicked. One line of code will deal with that.</p>
<h4>Part 4: Dealing with the linking mechanism</h4>
<p>Imagine the scenario: Someone comes into your website at page1.php, then clicks on a link to page2.php which is loaded in through AJAX. They bookmark the page. Now the URL points to page1.php and we need content from page2.php. We know that we want the content from page2.php because the hash will indicate this. So we can just get jQuery to load in the content (which we can do because we know the page to get the content from (from the hash), and just append it with ?AJAX=1). </p>
<h4>Putting it all together</h4>
<p>You might be surprised that you can build a fully functioning AJAX site with just 10 lines of jQuery (and it could be a lot less). I say you can, and here&#8217;s the code for <em>all three</em> of the above steps. (Obviously it&#8217;s longer than ten lines because I have put in some comments, but strip them out and it&#8217;s only ten!)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">// Part 4</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>location.<span style="color: #660066;">hash</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #006600; font-style: italic;">// the substring is to get rid of the '#' at the beginning</span>
		<span style="color: #006600; font-style: italic;">// the $.get function takes three arguments:</span>
		<span style="color: #006600; font-style: italic;">//		the page to load </span>
		<span style="color: #006600; font-style: italic;">//		any GET parameters (in this case AJAX=1</span>
		<span style="color: #006600; font-style: italic;">//		what to do on success. (in this case update #content-area</span>
		$.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span>location.<span style="color: #660066;">hash</span>.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>AJAX<span style="color: #339933;">:</span><span style="color: #3366CC;">'1'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#content-area&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #006600; font-style: italic;">// Part 2: the HIJAX.</span>
	<span style="color: #006600; font-style: italic;">//		(in this case, add AJAX calls to all anchors in #navigation)</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#navigation a&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #006600; font-style: italic;">// load in the new content (from the same page as the anchor's href attribute) </span>
		<span style="color: #006600; font-style: italic;">// then put the resulting html into #content-area</span>
		$.<span style="color: #660066;">get</span> <span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;href&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>AJAX<span style="color: #339933;">:</span><span style="color: #3366CC;">'1'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#content-area&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #006600; font-style: italic;">// and this line is for part 3</span>
		location.<span style="color: #660066;">hash</span><span style="color: #339933;">=</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;href&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #006600; font-style: italic;">// this stops the browser from loading the whole page</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Whether you put this into an external javascript file, or at the bottom of footer.php is up to you. In the example, I have put it at the bottom of footer.php. To see the fruits of my labour in action, visit the <a href="/examples/ajax-is-easy-but-remember-accessibility/index.php" target="_blank">Example Accessible AJAX website</a>. You might like to also try visiting <a href="/examples/ajax-is-easy-but-remember-accessibility/index.php#page1.php" target="_blank">page 1</a> (which you&#8217;ll notice is loaded in by the javascript, so you see the content for page1.php even though you initially load index.php). And of course, you could just look at the <a href="/examples/ajax-is-easy-but-remember-accessibility/index.php?AJAX=1" target="_blank">AJAXified content</a>. As usual, I have zipped up all of the files used in this tutorial for you to <a href="/examples/ajax-is-easy-but-remember-accessibility/ajax.zip">download</a>.</p>
<h4>Final thoughts</h4>
<p>This tutorial only scrapes the surface of AJAX, so while this is a starting point, it is by no means ready for deployment for live sites. Ofcourse, it works, but there are other things that you will need to consider (a &#8216;web 2.0&#8242; loading animation? What do you want to do if the hash points to a page which doesn&#8217;t exist? Are there other parts of the page which need to be updated too (i.e. the title bar, sub navigation or tactical boxes)?). </p>
<p>It might be more desirable for you to have a single (or a few) php file(s) which deal with all of the AJAX requests rather than each page delivering both regular and AJAX versions of the same content. This will definitely be the case in websites using MySQL or similar rather than flat static files like in the example. Also you might like to look at other ways to deliver the content (after all, the X in AJAX stands for XML), both jQuery and PHP have support for JSON, I would suggest having a look at that.</p>
<p>Forwards and back buttons: currently they have no effect on the site. Would you like your users to be able to go back a page by pressing the back button? I would recommend this. There a plenty of plugins out there which will help you to complete this task.</p>
<p>Finally, DON&#8217;T, for god&#8217;s sake, use AJAX just because you can! There is really no need for me to have used it in the example (other than it was about AJAX, of course), there is nothing more annoying to me than a website which uses AJAX because the author had read about it the night before. Please don&#8217;t be one of those people!</p>
<p>Have I missed anything out? What are your thoughts?</p>
<h4>Grab the files</h4>
<p>You can download the files used for the example site <a href="/examples/ajax-is-easy-but-remember-accessibility/ajax.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://slightlymore.co.uk/ajax-is-easy-but-remember-accessibility/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Better, faster and more robust rollovers with CSS sprites</title>
		<link>http://slightlymore.co.uk/better-faster-rollovers-with-css-sprites/</link>
		<comments>http://slightlymore.co.uk/better-faster-rollovers-with-css-sprites/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 19:35:57 +0000</pubDate>
		<dc:creator>Clinton Montague</dc:creator>
				<category><![CDATA[Accessibility / Usability]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Google / SEO]]></category>
		<category><![CDATA[HTML / XHTML]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Javascript / jQuery]]></category>
		<category><![CDATA[accessibility]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[sprites]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://slightlymore.co.uk/?p=209</guid>
		<description><![CDATA[Learn how to create faster, standards compliant, javascript-less and accessible buttons using only CSS. Even the most hard-core of javascript programmers will admit that actually, they might have done this by mistake. And I promise to show you how, and if you're lucky explain why.

I'll even tell you what a sprite is.]]></description>
			<content:encoded><![CDATA[<p>Do you remember the olden days? You know, the ones where we had 56k modems, a mouse with only two buttons, and the only way to have a rollover state were those horrid MM_SwapImage javascript functions (or whatever they were called). I do. And I remember that it was actually only a small number of years ago. A large proportion of people are still using javascript for this task, maybe they&#8217;re stuck in their old ways. I want to show you a much sleeker, and if I&#8217;m honest, a much sexier way to do the same thing. If you can&#8217;t wait, I have put together <a href="/examples/css-sprites/">an example</a>.</p>
<h4>So what&#8217;s a sprite</h4>
<p>A sprite is essentially a picture. They can be 2d or 3d and are normally animated or move in some way. Strange to use a different word, but you know what us geeks are like. We like to make things sounds more complicated than they actually are, all the time. How many acronyms go into the technology of this page, for instance. WordPress is built in <em  class="highlight">PHP</em> using the <em  class="highlight">MySQL</em> database. It was uploaded with <em class="highlight">FTP</em>, to a <em class="highlight">LAMP</em> server which I manage using <em class="highlight">SSH</em>. The pages are serverd over <em class="highlight">HTTP</em> and are <em class="highlight">XHTML</em> which is styled using <em class="highlight">CSS</em> which is also used to position the <em class="highlight">PNG</em> image in the header. Ok, ok, I&#8217;ll stop, you get the picture. So a sprite is an image. Think of a picture of Sprite<sup>tm</sup> if that will help. (<em class="highlight">lol</em>?)</p>
<h4>What&#8217;s wrong with Javascript?</h4>
<p>Nothing! Please, be my guest, continue using javascript until your heart is content. But it <em>will</em> become content. It&#8217;s a lot of work having to put your images in an array, get the hover states working independently and hitting your head against your desk. Then ofcourse, there&#8217;s always that annoying paranoid troglodyte of a client who has their javascript disabled so can&#8217;t see your beautiful handiwork.</p>
<h4>Why is your CSS method so great then, huh??!</h4>
<p>Sure, my client could have CSS disabled just like yours had javascript disabled. But then, my CSS disabling client is <em>used</em> to only seeing the web in 16pt times new roman with blue links. Using this CSS instead of swapping images will, believe it or not, improve the semantic meaning of your code. Which means google and friends will understand your site better too! Sounds too good to be true, doesn&#8217;t it! Shall we press on?</p>
<h4>The theory</h4>
<p>The idea here is to create a fully standards compliant, fully accessible and gracefully degradable graphical button using only HTML and CSS.</p>
<p>Let&#8217;s start with the the HTML for a graphic and turn it into a link, like a normal image link.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://slightlymore.co.uk/&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;button.png&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;My button&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span></pre></td></tr></table></div>

<p>Problem number 1: It&#8217;s not accessible. Well, sure, it&#8217;s got an alt tag, but let&#8217;s be pedantic here. Solution: Let&#8217;s remove the image and replace it with the text. After that, set the <em>a</em> tag to be displayed as a block (which allows you to specify the height and width), give it an id (so we can pick it out), give it a class of button (there will be other buttons like it so may as well use this to style it up) then use the picture as a background image.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;">	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://slightlymore.co.uk/&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;button&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;sexy-button&quot;</span>&gt;</span>Sexy button<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.button</span>
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">184px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">35px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#sexy-button</span>
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">sexy-button.png</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>Great! Oh, except for the fact that the text is over the button. So let&#8217;s surround the text with a <code>span</code>, then tell the span to go away with CSS.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.button</span> span
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-9999px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<h4>Wasn&#8217;t it supposed to move?</h4>
<p>Welcome to the magic of CSS sprites. Remember how those rollover buttons were made of two graphics, one for the on state and one for the off state? Well use some photoshop glue to place them on top of each other (the off state at the top). I know, I know, it&#8217;s bigger than the size of the background, but that&#8217;s the awesome thing! Now, using only css, we can <em>move the position of the background</em> when the user rolls over the anchor tag using the :hover psuedo class.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.button</span><span style="color: #3333ff;"><span style="color: #00AA00;">:</span>hover
</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span> <span style="color: #933;">-35px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* moving up by the height of the button */</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p><em>AND</em> because it&#8217;s just a single image, the user won&#8217;t see the short delay and flicker when they roll over your button because the browser doesn&#8217;t have to load a new image!</p>
<p>The applications of this are immense. Just imagine having the on, off and active states all in one image and all controlled with your new friend, css. If you have gone on to use this, post a link to your new page!</p>
<p>And for graceful degradation:</p>
<ul>
<li>Javascript disabled: Great, we didn&#8217;t use it anyway</li>
<li>CSS disabled: Great, you&#8217;ll see the text link</li>
<li>Google: Great, keep your text contextual (i.e. describe where the user will go instead of &#8220;click here&#8221;)</li>
<li>Screen readers: Great, there were no images involved so the program can read the text</li>
</ul>
<p>You can <a href="/examples/css-sprites/css-sprites.zip">download the files</a> in the <a href="/examples/css-sprites/">example page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://slightlymore.co.uk/better-faster-rollovers-with-css-sprites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
