PDA

View Full Version : Scrollable content II Horizontal



AndieR
08-10-2005, 08:38 PM
Hello,

I would like to see if it's possible to make the following script scroll horizontaly, I've been trying to change the variables but to no avail I'm afraid...

http://www.dynamicdrive.com/dynamicindex11/scrollc2.htm

Any help greatly appreciated!

Regards,
Andie

AndieR
08-10-2005, 08:47 PM
Hello!

Just a note to let you know I eventually sorted the answer out, thought I would post it in case it could be of any use for someone else.

Regards,
Andrea

Replace the last script by this version:

<script language="JavaScript1.2">
if (iens6){
var crossobj=document.getElementById? document.getElementById("content") : document.all.content
var contentwidth=crossobj.offsetWidth
}
else if (ns4){
var crossobj=document.nscontainer.document.nscontent
var contentwidth=crossobj.clip.width
}

function moveleft(){
if (iens6&&parseInt(crossobj.style.left)>=(contentwidth*(-1)+100))
crossobj.style.left=parseInt(crossobj.style.left)-speed+"px"
else if (ns4&&crossobj.left>=(contentwidth*(-1)+100))
crossobj.left-=speed
moveleftvar=setTimeout("moveleft()",20)
}

function moveright(){
if (iens6&&parseInt(crossobj.style.left)<=0)
crossobj.style.left=parseInt(crossobj.style.left)+speed+"px"
else if (ns4&&crossobj.left<=0)
crossobj.left+=speed
moverightvar=setTimeout("moveright()",20)

}

function getcontent_width(){
if (iens6)
contentwidth=crossobj.offsetWidth
else if (ns4)
document.nscontainer.document.nscontent.visibility="show"
}
window.onload=getcontent_width
</script>

emehrkay
11-13-2005, 09:30 PM
im looking to do this same thing, i've tried your above code but it doesnt work. inside of the ilayer i have a table with a whole bunch of <td>' containign thumbnails. i just want to scroll left and right. it goes right a little but not the whole way. how can i fix this?