Thread: Accessibility
View Single Post
  #4 (permalink)  
Old Jun 17th, 2007, 23:30
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 BGarner View Post
I would assume this is achieved by using multiple style sheets. In the CSS just change the font-size property and then save them as three different CSS files and link to them accordingly. That's how I would do it; I don't know if there is a better way...
You can also use javascript to increase font-size incrementally -- so the buttons mean "make the font larger/smaller".

I used to supply this feature, but decided it was unnecessary clutter. Text-resizing is best done by the browser, with controls that the user is familiar with.

The following code allows you to set minimum and maximum sizes, and choose which elements to apply resizing (you could even do it by class with some more code).

Code: Select all
var font_size = 1;
var MAX = 8000;
var MIN = 0.8;
function adjust_text(num)
{
    font_size += num;
    if(font_size > MAX)
    {
        font_size = MAX;
    }
    if(font_size < MIN)
    {
        font_size = MIN;
    }
//    document.getElementsByTagName("body")[0].style.fontSize = font_size + "em";            // Use this for resizing all text on the page
    document.getElementById("resize").style.fontSize = font_size + "em";                        // Use this for resizing just one element
}    
adjust_text(0);

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