2011/2/17 Rajat Mittal <[email protected]>:
> The problem is related to the Image object in JavaScript that I am using to
> load these images. For certain images, when the onload fires the object
> width and height property which should be the image's( that just loaded )
> width/height are 0. This results in my polaroid frame to collapse. This is
> very weird as that image has actually been loaded successfully by the
> browser.
> Since the onload fires, the image has obviously loaded. So why is that its
> width/height property are occasionally 0 when I read them in my JS. I mean I
> can see the image in the network resource of the web-inspector. But somehow,
> its not being read in my JS.
Why not create some setTimeout in the onload handler, that will run
until there is some height / width of the item? If it doesn't get a
height / width in the next 5 second consider it not loaded or similar.

-- 
Poetro

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to