Addition to "top" not happiening

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sheldonlg

    Addition to "top" not happiening

    I define a div, excItem, with absolute positioning and with a top of
    400px. I then call a javascript function which does toggling of
    visibility and should do positioning as well. I loop though the parents
    with offsetTop to get the position of the clicking element, which here
    is set in "y".

    Here is the code snippet:

    excItem.style.t op = y + 20;
    alert('y=' + y + ' top=' + excItem.style.t op);

    The resulting alert give a value of 677 for y and 400px for
    excItem.style.t op.

    Does anyone have any ideas on why this might be happening.

    Notes:
    1 - The excItem is defined as is evident from the alert.
    2 - This worked fine in a test app I wrote.
  • Captain Paralytic

    #2
    Re: Addition to "top&qu ot; not happiening

    On 28 Feb, 15:47, sheldonlg <sheldonlgwrote :
    I define a div, excItem, with absolute positioning and with a top of
    400px. I then call a javascript function which does toggling of
    visibility and should do positioning as well. I loop though the parents
    with offsetTop to get the position of the clicking element, which here
    is set in "y".
    >
    Here is the code snippet:
    >
    excItem.style.t op = y + 20;
    alert('y=' + y + ' top=' + excItem.style.t op);
    >
    The resulting alert give a value of 677 for y and 400px for
    excItem.style.t op.
    >
    Does anyone have any ideas on why this might be happening.
    >
    Notes:
    1 - The excItem is defined as is evident from the alert.
    2 - This worked fine in a test app I wrote.
    possibly because the top property wants something like:

    (y + 20)+'px';

    Comment

    Working...