I have an <img src="..." />
tag with a default src
set. I'd like to have jQuery make an ajax request to get another image and when this new image is fully loaded, set the src of the <img ... />
tag so there's no flicker. I'd prefer not to do any of the preloaders like new Image().src="foo"
etc. I'd really like the iamges to load on an ajax request. Any ideas?
views:
383answers:
2
A:
This page has example code which does exactly what you are trying to do:
SolutionYogi
2009-07-16 01:16:42
Exactly what I needed! Thanks
Mark Ursino
2009-07-16 01:34:37
A:
You cannot load "a part" of a image onto the webpage so you cannot load it incrementally.
The image can be loaded by using a CSS class point to an image or using Image object of Javascript.
Since CSS cannot notify the page whether the image fully load so the approach new Images().src = "foo" is the best it can do.
Attach an event to it and "decorate" it to reduce flicker with FX effect: fade in, ....
thethanghn
2009-07-16 02:10:46