> I'm really interested in understanding more about this plugin. Could you > give an example of when and how it might be used? I know you listed some > sample code on your page but I'd like to get a use case for it.
[From the original thread:] Here's a simple example of where jQuery.ready is insufficient. A large- ish page (50kb) uses jQuery.ready to add rounded corners to the header at the top of the page. The title displays straight away with square corners; then the rest of the page loads (a delay of a second); then jQuery.ready fires and the corners abruptly become rounded. If we rounded the corners as soon as the header was available then the user experience would be smoother. - from http://groups.google.com/group/jquery-dev/browse_thread/thread/263b3ee5c6e4e63e/896356fc3f78c65d Generally this is useful when you want to use unobtrusive JavaScript to set up the page. Another example is setting up event handlers. You normally have to do this in jQuery.ready(), but this means the handlers don't get set up until the entire DOM has loaded. Until that time, the affected element will be inert, causing irritation when users click it expecting to see their popup calendar or whatever. The gap may only be a second or two, but it's long enough to annoy users and result in helpdesk calls. This recently occurred on a production site I am working on: the site uses YUI, so I was able to use YAHOO.util.Event.onAvailable() to set up the event as soon as the element was ready. That made me wonder whether such a facility existed in jQuery; hence the elementReady plugin.