June 09, 2005

Sizing Things Up

I've updated Skidoo Too (and only that layout because I'm lazy) with a little bit of nifty. It's a font size selector. You'll see at the bottom of the left column a group of 3 icons. Clicking on one of the icons will change the font size used for the page.

This is done with JavaScript and sets a cookie to remember the user's preference. On page load the user's stored font size preference set.

It's done quite easily, and in a very compatible manner, by simply altering the font size value of the body element. Because we're altering a style on an element, it's really easy to access in a compatible way via JavaScript. All we need to do is set the document.body.style.fontSize variable to some string value, like "110%", to set the font size.

This assumes that you're using percent or EMs to define your font sizes in your CSS. (Which of course you are.)

It's quick, it's easy, and probably worth the 2 seconds it takes to implement.

You can download the updated Skidoo Too layout here. Or grab the lastest ruthsarian_utilities.js and go to town.

Posted by Ruthsarian at 03:30 PM | Comments (0)

Comments

Post a comment










Code:
Type Code:

Remember personal info?







Categories