Throbber creates a loading animation for jQuery, ready to be used in your AJAX applications. Of course, the throbber is not limited to AJAX but can also be triggered manually.
Using the plugin is easy:
$("#button").throbber("click");
adds a loading animation (›throbber‹) to the DOM node with the ID ›button‹ which shows up when a click event is triggered.
The following is a list of all functions provided by the plugin:
$().throbber(); $().throbber(event); $().throbber(options); $().throbber(event, options); event is a string specifying the event to which the throbber should bind. The default here is ›click‹. options is a set of options (see below). Both parameters can be omitted
$().throbber();
$().throbber(event);
$().throbber(options);
$().throbber(event, options);
$.throbberShow(options); Immediately shows a throbber as specified. If no parent element is specified with options.parent, the throbber will be appended to the element.
$.throbberShow(options);
$.throbberHide(); Hide all throbbers.
$.throbberHide();
The plugin recognizes several options which are denoted in curly brackets.
If you don’t use AJAX, you don’t have to explicitly set the ›ajax‹ parameter to ›false‹. ›ajax‹ is merely present to prevent that manually created throbbers are hidden upon completion of AJAX requests.
The throbber element uses this HTML code:
<img src="throbber.gif" class="throbber" />
You can set wrapping code using the ›wrap‹ option.
You can create throbber images using http://www.ajaxload.info/.
$("#button").throbber(); Show a throbber when the button is clicked, replacing the button and stopping when all AJAX requests are completed.
$("#button").throbber();
$("#div").throbber("dblclick", {image: "throbber_2.gif"}); Show a throbber when #div is double-clicked, using a custom throbber image.
$("#div").throbber("dblclick", {image: "throbber_2.gif"});
Throbber is licensed under the GNU Lesser General Public License.