with a default value src. I would like jQuery to make an ajax request to ...">

Swap image src with jQuery Ajax request

I have a tag <img src="..." />with a default value src. I would like jQuery to make an ajax request to get another image, and when this new image is fully loaded, set the src tag <img ... />so that there is no flicker. I would prefer not to do any preloaders such as new Image().src="foo"etc. I would really like iamges to load on ajax request. Any ideas?

+5
source share
1 answer

You cannot upload a “part” of an image to a web page so that you cannot upload it step by step.

An image can be uploaded using a CSS class point for the image or using a Javascript image object.

Since CSS cannot notify the page whether the image is fully loaded, so the New Images () approach. src = "foo" is the best he can do.

Attach an event to it and “decorate” it to reduce flickering with the FX effect: fading, ....

-1
source

All Articles