Help with menu items
Help with menu items
Hi all,
I'm trying to make a menu with jq and I create some function but not work as I want.
Js file:
-
function EBID(k)
{
return(document.getElementById(k));
}
function hideMailMenu(e)
{
var mailMenu = EBID('mailMenu');
mailMenu.style.display = 'none';
}
function showMailMenu(e)
{
document.onmouseup = hideMailMenu;
var mailMenu = EBID('mailMenu');
mailMenu.style.left = e.clientX + 'px';
mailMenu.style.top = e.clientY + 'px';
mailMenu.style.display = '';
}
HTML:
-
<a href="#" onclick="showMailMenu(event);"> Menu option</a>
<div id="mailMenu" class="mailMenu" style="display:none;position:absolute;left:0px;top:0px;">
some items
</div>
The problem:
This show where I click not aligned above the link. How I do to show it donw the link and aligned?