Ooh. So, this would let jQuery get the width of an image, even if that image doesn't have an /explicit/ width attribute set? Sorry if I'm being dense, but I wasn't quite following the question above, and this would solve a problem I'm having with my figures plugin.
On 6/14/07, Erik Beeson <[EMAIL PROTECTED]> wrote:
There is a window.load event, and that's what you want to use: http://docs.jquery.com/Events#load.28_fn_.29 So you want: $(window).load(function() { // My stuff to do once all images are loaded... }); --Erik On 6/14/07, GianCarlo Mingati <[EMAIL PROTECTED]> wrote: > > Hi, > the question may not be clear but what i would like to know is how do > you get the width of an image AFTER the image has fully downloaded. > I use this chunk of code: var pictWidth = this.find("img").width(); > where "this" is the jQuery context. > > If tested locally (images loads immediately) it works and i have the > image WIDTH in pixel, but if i search for anew image (not in cache eg: > on a web server) the script is executed when the DOM is ready, It's > to soon, how do i say to jquery "get the width of image#myimage after > image#myimage ha fully downloaded? > > For what i understand jQuery only have a DOM iS Ready function. > http://demos.mootools.net/DomReadyVS.Load > > I would need a window.load function. > http://www.gcmingati.net/wordpress/wp-content/lab/jquery/imagestrip/imageslide-plugin.html > in fact on that page, the gallery won't work correctly if you don't > REFRESH the page. When reloaded the images are displayed on the fly > and the trick of getting the width of the images works. > >