Forum Moderators: open
The function fw_showmenu(menu,x,y,child) provides you
with the ability to locate the Drop Down menus at point
(x,y) in pixels on a webpage. The issue is that this
x and y positioning is absolute positioning from the
(0,0) origin of the webpage.
Does anyone know of a way to define relative positioning
say from the reference button that triggers the drop
down?
This way the button can be positioned anywhere
on the webpage and the drop down will always appear either
on, above, below, left, or right of this button relative
to the button - not the (0,0) point of the webpage.
This would make coding a lot easier and would make
the page more consistent from computer
to computer irrespective of resolution, etc.
It would make sense to have the capability to do this.
By utilizing a containing element (such as a <div>), it should be possible to constrain the display of an element within that container, relative to another element displayed within the container.
As a crude example, try the code below. Where ever you position the container div, the contained divs will follow in unison.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Untitled</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div id="container" style="position:relative;top:200px;left:300px;">
<div style="position:absolute;height:80px;width:160px;background:teal;"
onmouseover="document.getElementById('dropDiv').style.visibility='visible';"
onmouseout="document.getElementById('dropDiv').style.visibility='hidden';">
</div>
<div id="dropDiv" style="position:absolute;height:160px;width:80px;left:160px;background:red;visibility:hidden;">
</div>
</div>
</body>
</html>