Created
November 21, 2013 22:44
-
-
Save duskohu/7591174 to your computer and use it in GitHub Desktop.
Spinner extension for nette.ajax.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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