I'm changing the img src once i've loaded a json file, all this works fine. But I want to make sure the image is completely loaded. Which I can do using:
.one("load",function(){
alert("image has load yay");
});
But after reading various posts that not all browsers fire the load if the image is in cache. I don't seem to be getting this problem in the browser that are meant to cause this issue. But i've only test FF(6.0.2), Chrome(13.0.7) and Safari(5.0.5) on a mac. Now i'm sure IE must have a problem and is it only PC related. I'm running pretty recent versions of the browsers so has something changed in these to now fire load. Or my other thought is i'm running the latest version of jquery (1.6.3) has .load been changed?
I'm hoping it's all to do with running the latest jquery, but if not and it's an older browser issue then I need to put in a fix. I've tried a couple of solution on this site for example: jQuery loading images with complete callback And also some of the comments on the .load api page : http://api.jquery.com/load-event/#comment-30211903
But I can't seem to get them to work. The first one doesn't work at all and the second one seems to fall over with the .each().
This is the code i have so far which seems to work ok, but can't be sure as maybe an older browser issues.
$.getJSON(jsonURL, function(json) {
$("a.imgZoom img").attr("src", json[imageID].largeImage).one("load",function(){
alert("the image has loaded");
//do something here
});
$("a.imgZoom").attr("href", json[imageID].largeImage);
})
Thanks in advance for any help.
B