views:

79

answers:

2

I would like to catch an onFontSizeChange event and then do stuff (like re-render because the browser has changed font sizes on me). Unfortunately, no such event exists and so I must hack a way to do it.

I've seen people do things like place an 'm' in an invisible <div> element and then test for changes in the size to the element.

Does anyone have any good solutions?

A: 

What do you want to change when the user resizes the text? e.g. If you design your site well, you shouldn't need to do anything, it should just re-flow to handle the resized content automatically.

scunliffe
Amen!
mcandre
Correct. However I did not design the site. Regardless, even in a well-designed site there are situations where things will not re-flow nicely.
ntownsend
Also, this isn't an answer, it's a "turn down the suck, turn up the awesome" response. -1 :(
ntownsend
+4  A: 

See TextResizeDetector.js, (demo here, in depth article here).

Crescent Fresh
Hmm, tried that demo in Firefox3.5 doing CTRL+[+] it caught 3 out of 10 increases and each time it did catch it, it reported a negative size change. I'm not sure how robust/mature this script is but it doesn't seem to work.
scunliffe
It looks in FF like there's a difference between regular zooming and zooming with the 'Zoom Text Only' option selected. In the latter, it seems to catch all resize events.
ntownsend
@ntownsend: Opera only offers the one "Zoom" feature as well. No text resize code I've seen works in Opera.
Crescent Fresh