issues with IE and jQuery load()
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")
开发者_JAVA技巧 $("#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.
It is probably an issue with how IE handles opacity. Quirksmode on opacity
精彩评论