PDA

View Full Version : Scrollable content III - L-R



jessalken
03-14-2007, 09:43 PM
Hi..

I cant find the original thread now but I used this great script which scrolls from left to right.

However it starts/loads in the middle of the page.
How do I get it to start on the left side...

Many Thanks!




//Scrollable content III- By http://www.dynamicdrive.com
//Modified here by jscheuer1 in http://www.dynamicdrive.com/forums
//for right/left action

var speed, currentpos=curpos1=0,alt=1,curpos2=-1

function initialize(){
if (window.parent.scrollspeed!=0){
speed=window.parent.scrollspeed
scrollwindow()
}
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

var cent=document.getElementById('content').offsetWidth/2

function scrollwindow(){
temp=window.pageXOffset? window.pageXOffset : iecompattest().scrollLeft
alt=(alt==0)? 1 : 0
if (alt==0)
curpos1=temp
else
curpos2=temp

window.scrollBy(speed, 0)
}
onload=function(){
window.scrollBy(cent,0);
setInterval("initialize()",10);
}

</script>