Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * jQuery-plugin loadingIndicator
- *
- * used to show a loading indicator in the center of the given object
- *
- * usage: jQuery('#dialog').loadingindicator('show', { 'caption' : 'Bitte warten'});
- * jQuery('#dialog').loadingindicator('hide');
- **/
- (function($) {
- $.fn.loadingIndicator = function(command, settings) {
- settings = jQuery.extend({
- caption: ''
- }, settings);
- return this.each(function() {
- if (command == 'show') {
- $(this).css('position', 'relative');
- $(this).prepend(
- '<div id="dialogLoadingIndicator" style="text-align:center"><img src="' +
- '/img/loading.gif"/>' +
- (settings.caption ? '<p>' + settings.caption + '</p>' : '') +
- '</div>'
- );
- /*var left = parseInt(($(this).width() - $('#dialogLoadingIndicator').width()) / 2);
- left += parseInt($(this).css('paddingLeft'));
- var top = parseInt(($(this).height() - $('#dialogLoadingIndicator').height()) / 2);
- $('#dialogLoadingIndicator').css('position', 'absolute');
- $('#dialogLoadingIndicator').css('left', left + 'px');
- $('#dialogLoadingIndicator').css('top', top + 'px');
- */
- } else {
- $('#dialogLoadingIndicator').remove();
- }
- });
- }
- })(jQuery);
Add Comment
Please, Sign In to add comment