...

View Full Version : Position of pop up layer



gurra
11-13-2002, 10:37 AM
I'm making a drop down style menu with all menu links using the same layer.
However, I need to position the layer differently, depending on what link is clicked!

My layer looks like this:
<div id="details" name="details" style="position: absolute; width: 250px; height: 75px; visibility: hidden; background-color: black; color: white; font-family: verdana; font-size: 10px">
Details!
</div>

How can get the X and Y coordinates of the link so I can set the div's TOP and LEFT to show it on the right place?

Thanks
Gustaf

Mr J
11-13-2002, 04:13 PM
The following will move your layer.

ID, X, and Y positions are passed to the function via the link



<script>
function show(id,X,Y){
document.getElementById(id).style.pixelLeft=X
document.getElementById(id).style.pixelTop=Y
}
</script>

<a href="javascript:show('details',100,100)">Link 1</a>
<a href="javascript:show('details',100,200)">Link2</a>

gurra
11-13-2002, 04:29 PM
Thanks,
but I see now that my question was badly formed.
Links are from a database-generated list, I don't know the coordinated.
That's the real problem, I know how to position the layer - but I don't know how to get the coordinates of the link.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum