Web Development for 2012

Alexander Dickson - Web Developer covering PHP, jQuery / Javascript, XHTML, CSS, more

waitForImages jQuery plugin

Published on Saturday, 5th February 2011.

I have a new jQuery plugin available that eases some code that I found myself writing often to deal with isses, most notably WebKit returning incorrect element dimensions on DOM ready because it hasn't calculated the dimensions of descendent images yet. I call it waitForImages.

I've just been getting the hang of GitHub, and I've taken the project source there.

Please post all issues to the GitHub Issues page.

Comments

  • Ahmet Sali

    Posted on Tuesday, 27th December 2011 @ 8:40pm.

    Hi, i think this plugin is really useful, will be using on every project, i am confused about one thing, is it possible to make it wait for just the element i passed, not including the child ones of that element, or is the "waitForAll" parameter for that purpose ?

  • Dean Peterson

    Posted on Friday, 18th November 2011 @ 6:46am.

    Thank you very much for this plugin. I've been running into a lot of situations that require all images to load before rendering. My own solution was pretty primitive and buggy. Thanks for this more robust solution.

  • shani

    Posted on Tuesday, 11th October 2011 @ 11:36pm.

    Thanks
    Helped me a lot
    It will be great if you could paste a better explanation on css images on your github read me.
    Thanks again
    Shani

  • Kittinan

    Posted on Tuesday, 2nd August 2011 @ 8:06pm.

    awesome plugin!!!

  • jan

    Posted on Wednesday, 11th May 2011 @ 7:13am.

    found your jquery plugin, exactly what I need.
    but when I set waitforall to true I have some problems:
    It doesn't load all, so there is no finished callback, you can see it by each callback (loaded will never get the same as total). you can see this on my website http://www.moontools.ch/compilation-moon-tool/
    is this a bug? j

  • Alexander Dickson

    Posted on Friday, 11th February 2011 @ 12:45am.

    @nickf

    I wasn't aware of that bug, so thanks! I'll fix that for the next release.

  • nickf

    Posted on Thursday, 10th February 2011 @ 8:34pm.

    Neat! It looks like that works even if the images have already loaded, too. The only suggestion I'd have would be to use `$.isFunction` instead of `typeof callback`. Webkit reports that regexes are functions for some bizarre reason.

Leave a Comment

Comment Details

Your email will never be displayed. If you have a gravatar, it will be displayed.

Note: Your comment may require approval before it is posted to the site.

Stack Overflow Profile

view full profile »

About

I'm a web developer from the Sunshine Coast, Australia. more »