Click to See Complete Forum and Search --> : ! problems with scrollBy !


amok13
01-30-2003, 05:14 AM
hi,
this is the problem:
This script don't work properly in Explorer Mac, Mozilla, Netscape...
In MIE (win) the scroll is smoothy, the other browsers "jump" to the point...

Here is the script:
function scrolla(DISTANZA,VELOCITA){
I=0;
DIR=0;
var x=parent.sotto.document.body.scrollLeft ;

if (x<DISTANZA){
spostamento=DISTANZA-x;
DIR=0;
}else{
spostamento=-(DISTANZA-x);
DIR=1;
}

while (I<=spostamento){
if (DIR==0){
parent.sotto.scrollBy(VELOCITA,0)
}else{
parent.sotto.scrollBy(-VELOCITA,0)
}
I=I+VELOCITA
}
}

Thank you...

havik
01-30-2003, 04:31 PM
The problem could be with this statement:

var x=parent.sotto.document.body.scrollLeft;

netscape and ie have different ways of defining this.

here is a URL that might help:

http://codepunk.hardwar.org.uk/bjs18.htm

look at this page and read the next few lessons.

Hope that helps