Results 1 to 4 of 4

Thread: Divs with position: absolute
      
   

  1. #1
    bennyceres is offline Corporal
    Join Date
    Dec 2007
    Posts
    13

    Default Divs with position: absolute

    Hi everyone,
    My domain name is italiarealestate.net and the URL is http://www.italiarealestate.net/english/test.html
    As you will see, on the right hand side of the page, there is a "contact us" button created with position: absolute. Ideally, I would like the button to be completely fixed so that when the page scrolls down the button stays in the middle without moving (as you will see, it is slightly shaking at present). Below follows the code:
    <script>
    if (!document.layers)
    document.write('<div id="divStayTopLeft" style="position:absolute">')
    </script>
    <layer id="divStayTopLeft">
    <!--EDIT BELOW CODE TO YOUR OWN MENU-->
    <table border="1" width="0" cellspacing="0" cellpadding="0">
    <tr>
    <tr>
    <td width="100%" bgcolor="#DF0101">
    <p align="center">
    <a href="http://www.italiarealestate.net/english/contactus.html">CONTACT US</a><br>
    </td>
    </tr>
    </table>
    <!--END OF EDIT-->
    </layer>
     
    <script type="text/javascript">
    /*
    Floating Menu script- Roy Whittle (http://www.javascript-fx.com/)
    Script featured on/available at http://www.dynamicdrive.com/
    This notice must stay intact for use
    */
    //Enter "frombottom" or "fromtop"
    var verticalpos="frombottom"
    if (!document.layers)
    document.write('</div>')
    function JSFX_FloatTopDiv()
    {
    var startX = 3,
    startY = 400;
    var ns = (navigator.appName.indexOf("Netscape") != -1);
    var d = document;
    function ml(id)
    {
    var el=d.getElementById?d.getElementById(id):d.all?d.a ll[id]:d.layers[id];
    if(d.layers)el.style=el;
    el.sP=function(x,y){this.style.right=x;this.style. top=y;};
    el.x = startX;
    if (verticalpos=="fromtop")
    el.y = startY;
    else{
    el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
    el.y -= startY;
    }
    return el;
    }
    window.stayTopLeft=function()
    {
    if (verticalpos=="fromtop"){
    var pY = ns ? pageYOffset : document.body.scrollTop;
    ftlObj.y += (pY + startY - ftlObj.y)/1;
    }
    else{
    var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
    ftlObj.y += (pY - startY - ftlObj.y)/1;
    }
    ftlObj.sP(ftlObj.x, ftlObj.y);
    setTimeout("stayTopLeft()", 10);
    }
    ftlObj = ml("divStayTopLeft");
    stayTopLeft();
    }
    JSFX_FloatTopDiv();
    </script>

    Many thanks in advance!
    Bennyceres

  2. #2
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,115

    Default Re: Divs with position: absolute

    I don't think you can have it absolutely fixed as the position of the button is fixed with Javascript and the browser has a slight delay in "adjusting" the button position each time you scroll the page.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  3. #3
    bennyceres is offline Corporal
    Join Date
    Dec 2007
    Posts
    13

    Default Re: Divs with position: absolute

    Thank you for your reply. I see your point.
    Then, either I get used to it or, I guess, have to change to something else.
    Regards,
    Bennyceres

  4. #4
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,115

    Default Re: Divs with position: absolute

    You couls search for something fixed at the bottom (just like this forum has)
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49