Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

positioning layers from window, not document

Status
Not open for further replies.

jdaniels

Technical User
Apr 23, 2002
63
0
0
GB
Hi,

I'm putting together a site which has a list of items, each of which has a mouseover event that pops up a layer at the position of the mouse cursor. This works fine until I scroll down the page. Then, when the mouse rolls over a link, the following scenario occurs: although the link may be near the bottom of the document, it may be near the top of the visible window and the layer pops up the same distance from the top of the document that the cursor is below the top of the visible window. This means that the layer instances associated with links lower down the page are never visible, because they are too close to the top of the document and therefore have been scrolled off.

Code extract:
============================
function showDescription (svc, text) {

// this just makes the layer visible - it works
setLayerVisibility ('popupText', 'visible');

document.all.popupText.style.left = window.event.x;
document.all.popupText.style.top = window.event.y;

}
============================

I need to position the layer from the reference point of the window, rather than the document, OR get the x and y coordinates of a mouse event with respect to the document, rather than the window. Any ideas on how to do this?

Thanks,

Jon Daniels

Browser version: MSIE 6.0.2600
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top