I have the following function which works fine in every browser but IE. When loading one image and then going back and clicking on the same <a> tag the image fades out but does not load back in. I am puzzled to why this works in other browsers but not in IE. Any and all insight greatly appreciated.
$('a').click(function({
$("#el").animate({
opacity: 0
}, 800,
function(){
$("<img/>").attr('src', 'http://www.google.com/images/logos/ps_logo2.png').load(function(){
$("#el img").attr('src', "http://www.google.com/images/logos/ps_logo2.png")
$("#el").animate({
opacity: 1
},
800)
});
});
});
Assign the load-function before setting the src.
The image is in the cache after the first click, so it will be loaded immediately, the .load() comes to late.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With