Positioning a popup relative to a table cell

Discussion in 'ASP .Net' started by chris f, Jun 14, 2008.

  1. chris f

    chris f Guest

    Some of the cells in my ASP.NET 2 table have a popup that appears when the
    user hovers the mouse over a text area that is indicated using an anchor
    tag. The popup is implemented as a DIV tag (position: relative) and is
    displayed and hidden using Javascript which calculates the popup position.

    The table has vertical scrollbars and when the table is scrolled to the very
    top then the popup is positioned correctly. However, if the table is
    scrolled then the vertical positioning is incorrect and the popup isn't
    visible at all.

    Could someone help me out with the Javascript algorithm for setting the
    popup position? I've looked at the DOM properties (offsetTop etc) but I
    can't get a working algorithm that takes into account the scrollbar
    position.
     
    chris f, Jun 14, 2008
    #1
    1. Advertising

  2. chris f

    Munna Guest

    On Jun 14, 1:49 pm, "chris f" <> wrote:
    > Some of the cells in my ASP.NET 2 table have a popup that appears when the
    > user hovers the mouse over a text area that is indicated using an anchor
    > tag. The popup is implemented as a DIV tag (position: relative) and is
    > displayed and hidden using Javascript which calculates the popup position.
    >
    > The table has vertical scrollbars and when the table is scrolled to the very
    > top then the popup is positioned correctly. However, if the table is
    > scrolled then the vertical positioning is incorrect and the popup isn't
    > visible at all.
    >
    > Could someone help me out with the Javascript algorithm for setting the
    > popup position? I've looked at the DOM properties (offsetTop etc) but I
    > can't get a working algorithm that takes into account the scrollbar
    > position.


    Hi,,,,

    this is the property you need to adjust

    document.body.scrollTop

    add this to your logic where you set "Y" postion

    Best of luck

    Munna
    www.munna.shatkotha.com
    www.munna.shatkotha.com/blog
    www.shatkotha.com
     
    Munna, Jun 14, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rob R. Ainscough
    Replies:
    2
    Views:
    1,679
    Rob R. Ainscough
    Feb 7, 2006
  2. Fred Nelson
    Replies:
    1
    Views:
    2,500
    Christopher Reed
    Feb 21, 2006
  3. B. Clay

    Relative Positioning of a Point

    B. Clay, Mar 3, 2004, in forum: Java
    Replies:
    2
    Views:
    388
    Thomas Weidenfeller
    Mar 3, 2004
  4. Pat Traynor
    Replies:
    3
    Views:
    673
    Sid Ismail
    Sep 24, 2003
  5. Jens Peter Hansen
    Replies:
    7
    Views:
    590
    Randy Webb
    Jun 19, 2004
Loading...

Share This Page