Webmaster

DHTML : Text scrolling
Contents ]
Mikael Le Moal

Creating the Links

Now we are all set for flawless moving our layers. We still have to create the animation triggering components: two simple links and the associated function for controlling the layer movement.

96: // Function which starts the scrolling
97: function go(vitesse){
98: loop=true;
99: if(vitesse>0) Texte.bas(vitesse);
100: else Texte.haut(vitesse);
101: }
102:
103: // Function which stops the scrolling
104: function stop(){
105: loop=false;
106: if(timer) clearTimeout(timer);
107: }

  [...]

138: Choose the scrolling direction: <br>
139: <A HREF="javascript:void(0)" onmouseover="go(-2)" onmouseout="stop()">[Up]</A>
140: --
141: <A HREF="javascript:void(0)" onmouseover="go(2)" onmouseout="stop()">[Down]</A>

When the mouse pointer is positioned on one of the links (onmouseover event), the go() function is called up with a certain scrolling value (here 2 or -2). Depending on the value, the haut() or bas() function is called up to move the text layer.

If the cursor leaves the link area (onmouseout event), the stop() function is called up to stop the movement.

A last glance at the result?

Passive links If you want to disable the clicks on your links, just insert the expression javascript:void(0) as the value of the HREF attribute, i.e. where you normally enter an URL.




  1   2   3   4