Skip to content

Instantly share code, notes, and snippets.

@duskohu
Created November 21, 2013 22:44
Show Gist options
  • Save duskohu/7591174 to your computer and use it in GitHub Desktop.
Save duskohu/7591174 to your computer and use it in GitHub Desktop.
Spinner extension for nette.ajax.js
#ajax-spinner {
position: fixed;
width: 32px;
height: 32px;
/* - use if you use bacground image, no ico */
/*background: url('../img/ajax_loader.gif') no-repeat;*/
z-index: 123456;
color: green;
}
(function ($, undefined) {
$.nette.ext('spinner', {
init: function (x) {
this.spinner = this.createSpinner();
this.spinner.appendTo('body');
},
start: function (jqXHR, settings) {
this.spinner.css({
left: '50%',
top: '30%'
});
this.spinner.show(this.speed);
},
complete: function () {
this.spinner.hide(this.speed);
}
}, {
createSpinner: function () {
var spinner = $('<div>', {
id: 'ajax-spinner',
css: {
display: 'none'
}
});
// -- delete if you use bacground image, no ico
var icon = $('<i>', {
class: 'icon-gear icon-spin icon-4x'
});
spinner.append(icon);
// -- delete if you use bacgroun image, no ico
return spinner;
},
spinner: null,
speed: undefined
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment