I need to let scroll a background image in the browser window.
I found this script which works pretty well:
<script language="JavaScript">
var backgroundOffset= 0;
var bgObject=eval('document.body');
function scrollBG(maxSize){
backgroundOffset = backgroundOffset +1;
if( backgroundOffset > maxSize) backgroundOffset = backgroundOffset=0;
bgObject.style.backgroundPosition= "0" - backgroundOffset;
}
var ScrollTimer = window.setInterval("scrollBG(290)",64);
</script>
BUT! because of the if( backgroundOffset > maxSize) backgroundOffset = backgroundOffset=0;
my background image "jumps" back into position at the end of the scroll. I would like it to scroll back backwards, and forward and backwards... like a ping-pong ball.
Any help?
thanx
toma4toma
I found this script which works pretty well:
<script language="JavaScript">
var backgroundOffset= 0;
var bgObject=eval('document.body');
function scrollBG(maxSize){
backgroundOffset = backgroundOffset +1;
if( backgroundOffset > maxSize) backgroundOffset = backgroundOffset=0;
bgObject.style.backgroundPosition= "0" - backgroundOffset;
}
var ScrollTimer = window.setInterval("scrollBG(290)",64);
</script>
BUT! because of the if( backgroundOffset > maxSize) backgroundOffset = backgroundOffset=0;
my background image "jumps" back into position at the end of the scroll. I would like it to scroll back backwards, and forward and backwards... like a ping-pong ball.
Any help?
thanx
toma4toma