Thread: Accessibility
View Single Post
  #12 (permalink)  
Old Jun 18th, 2007, 23:14
MikeHopley MikeHopley is offline
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Accessibility

Quote:
Originally Posted by karinne View Post
That's actually what I used first for my site.

Later on, however, when I needed more style switching, I found their approach a little heavy-handed. Instead of specifying alternate stylesheets, I just added all the stylesheets by default, then disabled them with javascript:

Code: Select all
document.getElementById("myStyleSheet").disabled=true
This helped me to manage eight "alternate" stylesheets modularly, with relatively little javascript.

Then you can enable them as required:

Code: Select all
document.getElementById("myStyleSheet").disabled=false
The disadvantage is that these will no longer be identified as alternate stylesheets by the browser, so you won't be able to switch them using the browser.

Of course, you still have to track the styles with cookies.

To make it degrade gracefully when javascript is off, I added a final stylesheet (the last one takes precedence, all other things being equal), which resets all the styles to default.

Last edited by MikeHopley; Jun 18th, 2007 at 23:18.
Reply With Quote