diff --git a/source/Ox.UI/js/Core/LoadingIcon.js b/source/Ox.UI/js/Core/LoadingIcon.js index dab5c716..bd530437 100644 --- a/source/Ox.UI/js/Core/LoadingIcon.js +++ b/source/Ox.UI/js/Core/LoadingIcon.js @@ -29,11 +29,13 @@ Ox.LoadingIcon = function(options, self) { ? that.css({width: self.options.size, height: self.options.size}) : that.addClass('Ox' + Ox.toTitleCase(self.options.size)); + that.stopAnimation = that.stop; + /*@ start Start loading animation () -> Loading Icon Element @*/ - that.start = function() { + that.start = function(callback) { var css, deg = 0, previousTime = +new Date(); if (!self.loadingInterval) { self.loadingInterval = setInterval(function() { @@ -49,7 +51,9 @@ Ox.LoadingIcon = function(options, self) { WebkitTransform: css }); }, 83); - that.animate({opacity: 1}, 250); + that.stopAnimation().animate({opacity: 1}, 250, function() { + callback && callback(); + }); } return that; }; @@ -58,12 +62,20 @@ Ox.LoadingIcon = function(options, self) { stop Stop loading animation () -> Loading Icon Element @*/ - that.stop = function() { + that.stop = function(callback) { var loadingInterval = self.loadingInterval; if (self.loadingInterval) { self.loadingInterval = void 0; - that.animate({opacity: 0}, 250, function() { + that.stopAnimation().animate({opacity: 0}, 250, function() { + var css = 'rotate(0deg)'; clearInterval(loadingInterval); + that.css({ + MozTransform: css, + MsTransform: css, + OTransform: css, + WebkitTransform: css + }); + callback && callback(); }); } return that;