Accessibility
Articles in some way related to accessibility, or accessible code-examples.
There are 5 articles published in this category. Please try the search if you can't fint what you're looking for.
One reason why headings are important
Tuesday, August 12, 2008
- Comments are off
- Filed under (X)HTML, Accessibility, Semantics, Web Standards
jQuery Imgbox Plug-In
Monday, November 26, 2007
I'm working on a new version of this which will eventually show up on AndreasLagerkvist.com - In the mean time, please check out my image zoom plug-in. The code for the imgbox has been removed.
This plug-in will make any link pointing to an image (png, gif, jpg or bmp) open in the "Imgbox". The Imgbox centers on screen and displays whatever image the link was pointing to, together with the link's title, the image'a alt-attribute and a list of all other images in the same scope.
This way you can use imgbox to create "albums" of images by simply applying the imgbox to different sections of your site.
Say for example you have "Random Images" and "Holiday Pictures"-sections on your site, each wrapped in its own div, then you can use the imgbox to group each set of images like this:
$('#holiday-photos, #random-images').imgbox();
Do not target the links themselves as imgbox looks for links inside the element you tell it to.
It requires jQuery and my center plugin for jQuery and you can get the code here. The default styling of the imgbox can be found here but it's very easy to apply your own styling using the default as a guide.
- Comments are off
- Filed under Accessibility, Javascript, jQuery, Progressive Enhancement
jQuery Color Picker Plug-In
Friday, November 23, 2007
A simple colour-picker plug-in for jQuery. Use it like this: $('select[name="colour"]').colourPicker();
Where the XHTML looks like this:
<form method="post" action="">
<p>
<label>Select a Colour<br />
<select name="colour">
<option value="ff0000">Red</option>
<option value="00ff00">Green</option>
<option value="0000ff">Blue</option>
</select>
</label>
</p>
</form>
And the colourPicker plug-in will turn the select in to a normal input[type="text"] and add a colour-picker icon to the right of it. Clicking the icon will bring up a dialog box allowing you to select any of the colours that were present in the select-element.
You can check it out in action here.
It requires jQuery and you can get the code here. The default styling of the colour-picker can be found here but it's very easy to apply your own styling using the default as a guide.
And as a bonus, here's a little PHP-function that will generate a list of "web-safe" colours:
<?php
function gwsc() {
$cs = array('00', '33', '66', '99', 'CC', 'FF');
for($i=0; $i<6; $i++) {
for($j=0; $j<6; $j++) {
for($k=0; $k<6; $k++) {
$c = $cs[$i] .$cs[$j] .$cs[$k];
echo "<option value="$c">#$c</option>n";
}
}
}
}
?>
Use it like this:
<select name="colour">
<?php gwsc(); ?>
</select>
Enjoy, and do leave some feedback.
- Comments are off
- Filed under Accessibility, Javascript, jQuery, Progressive Enhancement
Using a Logical Document Outline
Tuesday, November 13, 2007
Using the 6 different heading-elements is very important for both SEO and accessibility but many websites out there completely ignore to use them or use them in a, to me, illogical way.
Many times people ignore to use them for, what I believe are, obvious headings and will simply use a strong-element (em and b are common as well) instead.
To me any kind of text that describes what a section of your site is about is a heading. If you check the source of exscale.se you will notice that I use headings in almost every one of my modules. "Recent Comments", "Most Popular Articles" etc are all headings in my opinion.
The Web Developers Toolbar-plugin for Firefox has a feature called "View Document Outline" which will give you an outline of the headings in your document. It complains if the document does not start with a h1 (as it always should) and if a heading following another heading is anything but 1 higher, 1 lower or equal to the heading-level that preceded it.
Therefore I believe the following statements to be true:
- There must never be more than 1 h1 per document
- The h1 must appear before any other heading
- It is illegal to follow an hx element by anything but a hx, hx+1 or hx-1-element. (In other words a h2 -> h4 structure would be invalid)
- An hx heading is a sub-heading to any preceding hx-1 heading and a super-heading to any following hx+1 heading
So, if you can only use one h1 per document, and any following h2 will be a sub-heading to the h1 then the question "what is a heading to the entire site?" arises. My answer: the name of your site. The name of your site is the only thing that can be considered a super-heading to all other headings in the document. And every other heading in your document should be a h2 (unless of course it's a sub-heading to one of your h2s).
Here's what exscale.se's document outline looks like (pretty much):
- h1 exscale.se
- h2 Navigation
- h2 Recent Articles
- h3 A recent article
- h3 Another recent article
- h4 Sub-heading to recent article
- h2 Search
- h2 Recent Comments
- h2 Poll
To me that makes perfect sense. If "Search", "Recent Comments" or "Poll" were anything but h2s they'd be sub-headings to "Recent Articles", which, obviously, isn't correct.
The way I see it is, use h1 for you site's title. Place it before any other heading in your document. Use h2 for other headings (unless, of course, they are actually sub-headings to an h2 in which case they should obviously be h3s (and so on..)).
I do it like this because to me it makes sense. Loads more sense than placing random h3s or h5s in your document based on how valuable you believe they are. At least if you do it like this you have a reason. On many sites that use headings the author simply seems to have picked randomly what he felt was a good heading for that section. This way there are logical rules for which heading to use.
How do you do it? What do you think about this approach? Do tell.
- Comments are off
- Filed under (X)HTML, Accessibility, Semantics, Web Standards
Ajax Scan
Tuesday, October 03, 2006
Ajax-Scan is a php/javascript (ajax) directory-listing script. It works like "explorer"on windows.
Ajax-Scan is still a bit under construction, but when i'm happy with it i'll release the code.
- Comments are off
- Filed under Accessibility, Ajax, Design, Javascript, PHP





