No calling mouse pointer position is wrong. I want to show menu above
the link and aligned.

this is all code:
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:
Code:

<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>



On 27 Lug, 22:41, Karl Swedberg <k...@englishrules.com> wrote:
> you still haven't clarified what you're trying to do. Are you trying  
> to get the mouse position or the offset coordinates of the moused over  
> element?
> And where are you calling the showMenu function?
>
> --Karl
>
> On Jul 27, 2009, at 3:37 PM, GONNY wrote:
>
>
>
>
>
> > function showMenu(e)
> > {
> > document.onmouseup = hideMenu;
> > var mailMenu = EBID('mailMenu');
> > /*
> > var offset = e.offset();
> > or
> > var offset = mailMenu.offset();
> > */
> > mailMenu.style.left = offset.left + 'px';
> > mailMenu.style.top = offset.top + 'px';
> > mailMenu.style.display = '';
> > }
> > not work :(
>
> > can give me an example how can do it.
>
> > On 27 Lug, 15:36, Karl Swedberg <k...@englishrules.com> wrote:
> >> On Jul 27, 2009, at 8:20 AM, GONNY wrote:
>
> >>> e.clientY and eclientx not work properly.
>
> >> Your subject refers to offset left/top, but it looks like your
> >> function is trying to get the mouse coordinates (e.clientX/e.clientY)
>
> >> for offset, use jQuery's offset method:
>
> >>http://docs.jquery.com/CSS/offset
>
> >> for mouse coordinates, use e.pageX and e.pageY:
>
> >>http://docs.jquery.com/Events/jQuery.Event#event.pageX.2FY
>
> >> This article may help explain why e.clientX/e.clientY aren't working
> >> for you:
>
> >>http://www.quirksmode.org/js/events_properties.html#position
>
> >> "As to the mouse position, the situation is horrible. Although there
> >> are no less than six mouse coordinates property pairs, there is no
> >> reliable cross–browser way to find the mouse coordinates relative to
> >> the document we need."
>
> >> --Karl
>
> >> ____________
> >> Karl Swedbergwww.englishrules.comwww.learningjquery.com- Nascondi testo 
> >> citato
>
> - Mostra testo citato -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to