Steven_Smith
01-15-2003, 04:51 PM
Hi everybody.
I was wondering if it is possible to use the scrollby(xx,xx); to scroll to a #target rather then a pre-set distance. Below is a scroll script I wrote. (its not the best, if the speed doesn't devide into the distance evenly it doesn't scroll to the right position)
Hmmm. any ideas?
thanks
steven
function scroller(distance,direction){
var i=0
var speed=10
var pixels=speed
if (direction=="back"){ pixels=pixels-(pixels*2) }
while(i < (distance/speed)){
scrollBy(pixels,0)
i++
}
}
<a href="javascript:scroller(800,'back')" >back</a>
I was wondering if it is possible to use the scrollby(xx,xx); to scroll to a #target rather then a pre-set distance. Below is a scroll script I wrote. (its not the best, if the speed doesn't devide into the distance evenly it doesn't scroll to the right position)
Hmmm. any ideas?
thanks
steven
function scroller(distance,direction){
var i=0
var speed=10
var pixels=speed
if (direction=="back"){ pixels=pixels-(pixels*2) }
while(i < (distance/speed)){
scrollBy(pixels,0)
i++
}
}
<a href="javascript:scroller(800,'back')" >back</a>