don't use animated loading icon svg (consumes 100% cpu in recent versions of chrome)

This commit is contained in:
rolux 2012-05-24 14:26:52 +02:00
parent f033877f41
commit 4b454790d5

View file

@ -25,21 +25,23 @@ Ox.LoadingIcon = function(options, self) {
'OxLoadingIcon Ox' + Ox.toTitleCase(self.options.size)
);
self.setOption = function(key, value) {
};
/*@
start <f> Start loading animation
() -> <f> Loading Icon Element
@*/
that.start = function() {
that.attr({
src: Ox.UI.getImageURL('symbolLoadingAnimated')
})
.animate({
opacity: 1
}, 250);
var deg = 0;
if (!self.loadingInterval) {
self.loadingInterval = setInterval(function() {
deg = (deg + 30) % 360;
that.css({
OTransform: 'rotate(' + deg + 'deg)',
MozTransform: 'rotate(' + deg + 'deg)',
WebkitTransform: 'rotate(' + deg + 'deg)'
});
}, 83)
that.animate({opacity: 1}, 250);
}
return that;
};
@ -48,13 +50,13 @@ Ox.LoadingIcon = function(options, self) {
() -> <f> Loading Icon Element
@*/
that.stop = function() {
that.animate({
opacity: 0
}, 250, function() {
that.attr({
src: Ox.UI.getImageURL('symbolLoading')
});
var loadingInterval = self.loadingInterval;
if (self.loadingInterval) {
self.loadingInterval = void 0;
that.animate({opacity: 0}, 250, function() {
clearInterval(loadingInterval);
});
}
return that;
};