Loading ...
Sorry, an error occurred while loading the content.

Dom.getStyle and image sizing in IE

Expand Messages
  • jessekeller
    I m trying to find out (then maybe change) the dimensions of an image. But IE seems to give very different answers to the question how big is this image ,
    Message 1 of 2 , Jul 4, 2006
    • 0 Attachment
      I'm trying to find out (then maybe change) the dimensions of an image.
      But IE seems to give very different answers to the question "how big
      is this image", depending on whether the image is in cache or not. I
      was hoping YAHOO.util.Dom.getStyle('myImg', 'width') would get around
      the problem, but apparently not.

      Anybody know how to reliably find out the actual (unscaled) size of an
      image loaded using document.createElement() in IE?

      Thanks!
    • Matt Sweeney
      Hi Jesse, I think that offsetWidth and offsetHeight are your best bet for getting the actual image dimensions, the one caveat being that you have to append to
      Message 2 of 2 , Jul 5, 2006
      • 0 Attachment
        Hi Jesse,

        I think that offsetWidth and offsetHeight are your best bet for getting
        the actual image dimensions, the one caveat being that you have to
        append to the document BEFORE querying offsets.

        Matt

        jessekeller wrote:

        >I'm trying to find out (then maybe change) the dimensions of an image.
        >But IE seems to give very different answers to the question "how big
        >is this image", depending on whether the image is in cache or not. I
        >was hoping YAHOO.util.Dom.getStyle('myImg', 'width') would get around
        >the problem, but apparently not.
        >
        >Anybody know how to reliably find out the actual (unscaled) size of an
        >image loaded using document.createElement() in IE?
        >
        >Thanks!
        >
        >
        >
        >
        >
        >
        >Yahoo! Groups Links
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.