Brownielocks and The 3 Bears
present
Java Script for
Auto-Scrolling or
Self-Scrolling Vertical Text
on a Fixed Background.
We made a sample page so you can get
an idea of what we are talking about.
Click our animated link below. It's not really a good example because it's
more jerky than the Javascript code, but we tried. ;)
Here is
the code. Put it between the
<head> and </head> of your html page
or "fixed" html page. Whatever you wish.
Speed
can be customized.
I highlighted in red "var speed=1"
If you want a zoomier scroll, then type in a larger number.
<SCRIPT
language=JavaScript1.2>
//change 1 to another integer to alter the scroll speed. Greater is faster var speed=1 var currentpos=0,alt=1,curpos1=0,curpos2=-1 function initialize(){ startit() } function scrollwindow(){ if (document.all && !document.getElementById) temp=document.body.scrollTop else temp=window.pageYOffset if (alt==0) alt=2 else alt=1 if (alt==0) curpos1=temp else curpos2=temp if (curpos1!=curpos2){ if (document.all) currentpos=document.body.scrollTop+speed else currentpos=window.pageYOffset+speed window.scroll(0,currentpos) } else{ currentpos=0 window.scroll(0,currentpos) } } function startit(){ setInterval("scrollwindow()",50) } window.onload=initialize </SCRIPT>
|