(function () {
var move = 1;
function makemove() {
var h = document.getElementById('header');
if (!h) return;
var bp = '';
if (h.currentStyle) {
bp = [h.currentStyle.backgroundPositionX, h.currentStyle.backgroundPositionY].join(' ');
} else if (window.getComputedStyle) {
bp = window.getComputedStyle(h, null).backgroundPosition;
}
if (bp == '') return;
var bpArray = bp.split(' ');
var bpLeft = parseInt(bpArray[0], 10);
bpLeft += move;
if (bpLeft < 0 || bpLeft > 100) {
move = -move;
bpLeft += move;
}
h.style.backgroundPosition = [bpLeft, '% ', bpArray[1]].join('');
}
setInterval(makemove, 1000);
})();
|