SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    always learning . . .
    Join Date
    Nov 2003
    Location
    UK
    Posts
    821
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    need to move DIV on unhide to position of another div

    As the title says.

    No attributes applied apart from "relative" on the positioned div and "absolute" on the div I wish to move.

    I want to set the absolute div to that of the relative div. However I cant get the values from the relative div i require.

    Where am i going wrong ? driving me crazy

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Portsmouth UK
    Posts
    1,488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd"
    >

    <
    html>

    <
    head>
      <
    title></title>
    <
    script language="JavaScript" type="text/javascript">
    <!--

    function 
    Reveal(obj){
     
    alert('top = '+obj.offsetTop);
     
    alert('left = '+obj.offsetLeft);
     
    alert('width = '+obj.offsetWidth);
     
    alert('height = '+obj.offsetHeight);
    }
    //-->
    </script></head>

    <body>

    </body>
    <center>
    <br><br><br>

    <div style="position:relative;width:120px;height:80px;background-color:red;"
     onclick="Reveal(this);" >
    Click<br>Me

    </div>
    </center>
    </html> 

  3. #3
    always learning . . .
    Join Date
    Nov 2003
    Location
    UK
    Posts
    821
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mad mad mad.

    Been trying this or very similar that I cant recognise between them earlier. This works though.

    Thank you very much. Youv'e made me realise it is possible. Were worrying it was not if you dont give the DIV attributes at run time.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •