[jQuery] Re: Determining when an image is fully loaded

2007-04-29 Thread wyo
On 28 Apr., 23:12, Mike Alsup [EMAIL PROTECTED] wrote: var $img = $('img src='+files[pos]+' id=file'+pos+'class=picture') .appendTo('#pictures') .bind('load', function() { alert('loaded') }); Thanks, this works. Why do you use appendTo instead of html? I must say I don't understand

[jQuery] Re: Determining when an image is fully loaded

2007-04-29 Thread wyo
On 28 Apr., 23:18, Erik Beeson [EMAIL PROTECTED] wrote: Maybe $('#pictures').html(...).children().bind(...) Amazingly this works, see http://www.orpatec.ch/gallery4.html But I think you're trying to hard to use jQuery. How about this (tested on FF2/Mac): Possibly but I want to learn jQuery.

[jQuery] Re: Determining when an image is fully loaded

2007-04-28 Thread Sean Catchpole
Try this: $('#pictures').html(...).bind(load,function(){...}); ~Sean

[jQuery] Re: Determining when an image is fully loaded

2007-04-28 Thread wyo
On 28 Apr., 15:39, Sean Catchpole [EMAIL PROTECTED] wrote: Try this: $('#pictures').html(...).bind(load,function(){...}); I've tried $('#pictures').html('img src=...').bind ('load', sizeImage); function sizeImage() { alert ('sizeImage'); } The alert is never shown, see

[jQuery] Re: Determining when an image is fully loaded

2007-04-28 Thread Mike Alsup
Wyo, Try something like this: var $img = $('img src='+files[pos]+' id=file'+pos+'class=picture') .appendTo('#pictures') .bind('load', function() { alert('loaded') }); But be aware that if the image is already in the browser cache the load event will not fire in IE. You can use the

[jQuery] Re: Determining when an image is fully loaded

2007-04-28 Thread Erik Beeson
Maybe $('#pictures').html(...).children().bind(...) But I think you're trying to hard to use jQuery. How about this (tested on FF2/Mac): var img = new Image(); img.onload = function() { img_width = this.width; img_height = this.height; }; img.src = '...'; $('#pictures').html(img); Or if you