On Sep 20, 2006, at 9:35 AM, <[EMAIL PROTECTED]>  
<[EMAIL PROTECTED]> wrote:

> How can I create a loading spinner or progress bar, when a jQuery  
> query happens?
> It should show an <img> with the spinner image, and when the work  
> is done, it should go away!

You could do something like this, taken from the jQuery API (check it  
out at visualjquery.com)

  $("#loading").ajaxStart(function(){ $(this).show(); }).ajaxStop 
(function(){ $(this).hide(); });

or if you want to actually create the image on the fly, something  
like this:
  $("body").ajaxStart(function(){ $(this).append('<img  
src="loading.gif" alt="loading" />'); }).ajaxStop(function(){ $ 
(this).find('img').remove(); });

adding it to your event handler should do the trick (not tested).

Cheers,
Karl
___________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to