Jan 15 2007
Continuing to clean up the DHTML effects I use on my site (see my previous post), I published a Positioning and Scrolling effect. It's quite handy, in that it allows to easily keep a DOM node (DIV, ...) in sight of the user at all times. This can be used, for example, for a "floating menu" like I have on my main page.
The DOM node moves with a variable speed. What I especially like in the way this effect is implemented is that the user can specify his own function to calculate the speed of the DOM node according to the distance to the target position. Of course I provide a default function, which is a factor of the square of the distance. This way, the Node "glides" smoothly to the position.
The Node can be repositioned either manually by calling a method, or when the user scrolls the page. Additionally, it can be pinned in both axis separately, so that it stops repositioning itself.