forked from 0x2620/oxjs
improving loading icon
This commit is contained in:
parent
b74c5bee15
commit
4f2dc7dd53
2 changed files with 29 additions and 13 deletions
|
|
@ -3215,9 +3215,9 @@ requires
|
|||
.addClass(
|
||||
"OxLoadingIcon Ox" + Ox.toTitleCase(self.options.size)
|
||||
);
|
||||
self.count = 0;
|
||||
self.deg = 0;
|
||||
function update() {
|
||||
Ox.print(self.deg, "deg");
|
||||
that.css({
|
||||
MozTransform: "rotate(" + self.deg + "deg)",
|
||||
WebkitTransform: "rotate(" + self.deg + "deg)"
|
||||
|
|
@ -3225,20 +3225,26 @@ requires
|
|||
}
|
||||
that.start = function() {
|
||||
self.deg = 0;
|
||||
that.css({
|
||||
opacity: 1
|
||||
});
|
||||
self.interval = setInterval(function() {
|
||||
self.deg = (self.deg + 30) % 360;
|
||||
update();
|
||||
}, 83);
|
||||
self.count++;
|
||||
if (self.count == 1) {
|
||||
self.interval = setInterval(function() {
|
||||
self.deg = (self.deg + 30) % 360;
|
||||
update();
|
||||
}, 83);
|
||||
that.animate({
|
||||
opacity: 1
|
||||
}, 250);
|
||||
}
|
||||
};
|
||||
that.stop = function() {
|
||||
clearTimeout(self.interval);
|
||||
self.deg = 0;
|
||||
that.css({
|
||||
opacity: 0
|
||||
});
|
||||
self.count--;
|
||||
if (self.count == 0) {
|
||||
clearTimeout(self.interval);
|
||||
self.deg = 0;
|
||||
that.animate({
|
||||
opacity: 0
|
||||
}, 250);
|
||||
}
|
||||
}
|
||||
return that;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue