jquery ui position fails with margin
        Posted  
        
            by oliwel
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by oliwel
        
        
        
        Published on 2010-05-24T22:55:22Z
        Indexed on 
            2010/05/24
            23:01 UTC
        
        
        Read the original article
        Hit count: 291
        
jquery-ui
|css-positioning
Hi, I am trying to use jQuery to position an inpage div (Context-Menu) relative to a clicked tablerow on a webpage. This works fine until I add an offset with either "left" or "margin-left" to the outer container. Using padding-left works....
The relevant code is:
$('#supermenu').position({
my: "left top",         
at: "left top",
of: $(event.target).closest('tr'),
collision: "fit" });
The caller looks like:
<tr onclick="getMenu(event)"><td>....
What happens: The left margin is added "twice" to the X Offset, so the Menu is not aligned to the left border of the table but somewhere right of it. The offset from the border is exactly the offset from the outer container.
Anybody can shed some light?
Oliver
© Stack Overflow or respective owner