Tuesday, December 1, 2009

[jQuery] load new image only when fully loaded

Hey guys,

I am struggling to load my piuc at the right time.
I am injecting an img which once loaded must call a function which will take
care of adjusting the size according to the width and height of the gallery.
Online there is a little delay, and my pics appears at the wrong time.
[CODE]

//Remove div holding the temp image
$('div#temp-image img#newtempimg').remove();
//Create a new image
var img = new Image();
//Add the new image in the temp div and inject it in its parent

$(img).load(function () {
$(this).hide();
$('div#temp-image').append(this);

$(resizeImg(imageSrc)); //FUNCTION TO BE CALLED ONCE LOADED

}).attr({
src: imageSrc,
id: "newtempimg"
})

return false;

[/CODE]

I hope my explanation make sense.

Thanks a lot for any help.

Regads,

Jerome
--
View this message in context: http://old.nabble.com/load-new-image-only-when-fully-loaded-tp26593464s27240p26593464.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

No comments: