How to determine the relative position of an element?

Discussion in 'Javascript' started by delerious@no.spam.com, Dec 7, 2003.

  1. Guest

    I know how to figure out the top coordinate of an element relative to the top
    of the document. I can use one of the following:

    - document.defaultView.getComputedStyle(document.getElementById(element_id),
    '').getPropertyValue('top')

    - document.getElementById(element_id).offsetTop

    But I don't know how to determine the top coordinate of an element relative to
    the top of the viewable area of the browser. Does anyone know how to do this
    (in IE, Opera, and Mozilla)?
     
    , Dec 7, 2003
    #1
    1. Advertisements

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. Luqman
    Replies:
    1
    Views:
    804
    Luqman
    Feb 7, 2006
  2. Konrad Hammerer
    Replies:
    14
    Views:
    790
    Jonathan N. Little
    Feb 7, 2008
  3. Gelonida
    Replies:
    0
    Views:
    865
    Gelonida
    Feb 19, 2011
  4. pardesiya

    How to determine TreeView SelectedNode relative position

    pardesiya, May 11, 2007, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    342
    pardesiya
    May 11, 2007
  5. Stephan Koser

    Absolute position of a relative element

    Stephan Koser, Jun 14, 2004, in forum: Javascript
    Replies:
    7
    Views:
    284
    Mike Foster
    Jun 18, 2004
  6. Replies:
    2
    Views:
    185
    Michael Winter
    Mar 18, 2006
  7. Petra Meier
    Replies:
    4
    Views:
    268
    Randy Webb
    Jan 11, 2007
  8. steven acer

    position of an element relative to the page

    steven acer, Oct 29, 2007, in forum: Javascript
    Replies:
    4
    Views:
    243
    steven acer
    Oct 30, 2007
Loading...