On Feb 14, 11:31 pm, "Rick Faircloth" <[EMAIL PROTECTED]>
wrote:

> I've never thought of specifying image
> size in em's.  The problem of image degradation would
> still be an issue, I'm sure, since an image may be
> specified for display in em's in a browser, but would still start
> its life in pixels (if it's not a vector graphic), unlike text, which isn't an
> enlargement of a static entity, but is created anew
> in larger dimensions.

jQuery to the rescue!

if (parseInt($("body").css("fontSize")) > 20) { // font-size in pixels

  // replace img with higher res source

}

In Firefox at least, $.css("fontSize") increases when you hit ctrl-+.
If you set the font in ems in a stylesheet, $.css("fontSize") returns
pixels, and the returned value increases with each ctrl-+. If you set
the font-size inline though ($.css({fontSize: "1.2em"}) ), then all
subsequent calls to $.css("fontSize") return the inline value.

I haven't tried other browsers.

It's worth playing around with. A plugin would be really cool. Imagine
this:

$("#myImage").setImage({low: "myLowResImage.png", high:
"myHighResImage.png"}.

Maybe someone's done it already. I might if no one else wants to :)

Chris

Reply via email to