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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s