Skip to content

Instantly share code, notes, and snippets.

@jjaramillo
Created November 30, 2011 05:19
Show Gist options
  • Save jjaramillo/1408138 to your computer and use it in GitHub Desktop.
Save jjaramillo/1408138 to your computer and use it in GitHub Desktop.
A simple jquery "loading" overlay
(function ($) {
$.fn.ajaxloader = function () {
var ajaxloader = $('<div class="Ajax-Loader"><div class="Ajax-Loader-Overlay"></div><div class="Ajax-Loader-Image ui-corner-all"><img src="DesktopModules/DondeCompro/UI/recursos/img/loadinfo.net.gif"/></div></div>');
this.after(ajaxloader);
ajaxloader.css('top', this.position().top).width(this.outerWidth()).height(this.outerHeight());
ajaxloader.find('.Ajax-Loader-Overlay').css('opacity', 0.5).width(this.outerWidth()).height(this.outerHeight());
ajaxloader.find('.Ajax-Loader-Image').css('top', -((ajaxloader.height() / 2) + 36));
ajaxloader.hide();
return ajaxloader;
};
})(jQuery);
.Ajax-Loader {
position: absolute;
z-index: 9999;
}
.Ajax-Loader .Ajax-Loader-Overlay {
background-color: black;
}
.Ajax-Loader .Ajax-Loader-Image {
background-color: black;
width: 72px;
height: 72px;
margin: 0 auto;
position: relative;
}
.Ajax-Loader .Ajax-Loader-Image img {
display: block;
padding: 12px;
}
@sun123
Copy link

sun123 commented May 17, 2013

dfdfdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment