forked from 0x2620/oxjs
adding files
This commit is contained in:
parent
1a1f8c9107
commit
1fa635f71b
2 changed files with 45 additions and 0 deletions
44
build/js/ox.load.js
Normal file
44
build/js/ox.load.js
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
(function() {
|
||||
var image = new Image(),
|
||||
src = document.scripts ?
|
||||
document.scripts[0].getAttribute('src')
|
||||
.replace('js/ox.load.js', 'png/ox.ui.classic/loading.png') :
|
||||
'/static/oxjs/build/png/ox.ui.classic/loading.png';
|
||||
image.src = src;
|
||||
image.onload = function() {
|
||||
var deg = 0,
|
||||
img = document.createElement('img'),
|
||||
key,
|
||||
style = {
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
width: '32px',
|
||||
height: '32px',
|
||||
margin: 'auto',
|
||||
//opacity: 0,
|
||||
MozUserSelect: 'none',
|
||||
WebkitUserSelect: 'none'
|
||||
};
|
||||
img.setAttribute('src', src);
|
||||
for (var key in style) {
|
||||
img.style[key] = style[key];
|
||||
}
|
||||
document.body ? loaded() : document.addEventListener('DOMContentLoaded', loaded, false);
|
||||
function loaded() {
|
||||
//var opacity = 0;
|
||||
document.removeEventListener('DOMContentLoaded', loaded, false);
|
||||
//document.body.style.background = 'rgb(240, 240, 240)';
|
||||
document.body.appendChild(img);
|
||||
setInterval(function() {
|
||||
//opacity += 0.083
|
||||
deg = (deg + 30) % 360;
|
||||
//img.style.opacity = Math.max(opacity, 1);
|
||||
img.style.MozTransform = 'rotate(' + deg + 'deg)';
|
||||
img.style.WebkitTransform = 'rotate(' + deg + 'deg)';
|
||||
}, 83);
|
||||
}
|
||||
}
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue