Divs with position: absolute

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • bennyceres
    Corporal

    • Dec 2007
    • 13

    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
  • navaldesign
    General & Forum Moderator

    • Oct 2005
    • 12080

    #2
    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!

    Comment

    • bennyceres
      Corporal

      • Dec 2007
      • 13

      #3
      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

      Comment

      • navaldesign
        General & Forum Moderator

        • Oct 2005
        • 12080

        #4
        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!

        Comment

        Working...
        X