My brother Rory Gullan is pretty handy with a camera. To tie in with his first exhibition I built him a website to showcase some of his photographs.
Of course, I needed to give him a photo gallery. I first considered using Gallery2, which I implemented for Oscar Whicheloe’s site, but ended up building something a bit more individual. While this approach means more manual work for making changes (which wouldn’t have been appropriate for Oscar’s site), I minimised this in a few key ways:
- The image for the overlay is determined by checking the value of the image “src” attribute rather than needing to manually pass it through to the javascript.
- The alt text for each of the thumbnails is read by the javascript and used for the little description box.
- I used jQuery. The point is more that I used a javascript library than which one I used - but jQuery certainly worked well!
When creating my news ticker plugin, I came across a slight complication when using setTimeout() to calling a function which needed parameters passed to it.
Not having had much call to use setTimeout in the past, I simply put:
setTimeout(myFunction(parameter),myTimeout);
but that doesn’t work. An apparent solution (until tried in Internet Explorer) is:
setTimeout(myFunction,myTimeout,parameter);
It wasn’t as easy as I expected to find out how to get around this, but it turns out that all is needed is a “closure”:
setTimeout(function(){myFunction(parameter)},myTimeout);
Wanting to create a news ticker along the lines of that used on the BBC news site, I took a look around for a handy plugin to do it, but with no success. So… I created my own, as a jQuery plugin.
A quick sample of how to use it follows, or you can see the news ticker in action. Continue reading BBC style news ticker
I’ve been having a lot of fun with jQuery recently. One of the things particularly easy to do with it is write nice and unobtrusive javascript (a good start when looking at progressive enhancement). This is largely down to the fact that it’s very easy to find particular elements within the DOM - with any level of specificity - and attach behaviour to them.
On the site I’ve been building at work, one particular example was to get jQuery to write in the “Print page” link, since that needs javascript.
// add print page link - since it can only work for JS, only add it for JS users
$('<li></li>') // create list item
.addClass('print') //add relevant class to it
.append('<a href="javascript:window.print();">Print this page</a>') //put in the link
.insertBefore('li a.foo'); //add before the li item with link of class 'foo'
The above example is slightly more verbose than it need be, but it illustrates some of the different built-in functionalities of jQuery quite well.
Continue reading Progressive enhancement with jQuery
Writing for the web is very different from writing for print. Key reasons for this are:
- Users scan web pages rather than reading every word.
- Users typically won’t give a web page their full attention. For example, they may also be listening to music and using instant messaging.
- Web pages are interactive.
The six elementary rules
George Orwell’s rules (”Politics and the English Language”, 1946) are just as relevant today for the web.
- Never use a metaphor, simile or other figure of speech which you are used to seeing in print. [The point here is not "print vs. web" but "avoid ones which are used all the time".]
- Never use a long word where a short one will do.
- If it is possible to cut out a word, always cut it out.
- Never use the passive where you can use the active.
- Never use a foreign phrase, a scientific word or a jargon word if you can think of an everyday English equivalent.
- Break any of these rules sooner than say anything outright barbarous.
Continue reading Web writing guidelines
Here’s a strange one I came across the other day. I’m posting this in the hope that I’ll save someone out there some time in the future.
I was applying a fade-out effect to a news ticker, and all was going well (thank you Yahoo! User Interface library!) until I was ready to test in Internet Explorer. Unfortunately, as soon as the second news item was displayed, the text suddenly gained a strange border effect (perhaps a glow or halo effect might also describe it - but it isn’t pretty).
Continue reading Problems with opacity in Internet Explorer
Two nights ago was the first Oxford Geek Night. This was basically a chance for web developers and designers to get together in a mixed business and social context.
I did one of the “microslots” - a five minute talk on “Avoiding accessibility pitfalls”. This is of course a huge area, and one I’d happily talk for hours about, so I focussed on three areas in which I keep seeing people trip up:
- Giving appropriate alt text
- Correct use of link text
- Using markup correctly
I’ll be elaborating on each of these areas in my next few posts; in the meantime, you can download my slides as a pdf.