Positioning the Write-Layer According to Scroll Amount

A relative-positioned div is placed in the right column. When the user hovers over a link, the amount of scroll is determined. That amount is used in calculating the vertical position of the write-layer so that it always appears at the same relative location in the window.




Over 2000+ free Javascript
at JavaScriptBank.com Website

Sampled by JavaScriptBank.com

Hover over the images to the left and the links below and information will be written to the layer in the right column.

A relative-positioned div is placed in the right column. When the user hovers over a link, the amount of scroll is determined. That amount is used in calculating the vertical position of the write-layer so that it always appears at the same relative location in the window.

Scroll and hover over the images and links to see for yourself. Notice this is a centered table.

The code includes support for Netscape 4, but since the layer is positioned relative in this example, Netscape 4 fails silently.

Click or right click to download the dw_layer.js file used by most of the writing to layers examples. You can save or view this document's source code using your browser menu commands.