Object that Appears All The Time?

Discussion in 'HTML & Website Design' started by abcdefGARY, Jul 16, 2006.

  1. #1
    Hello, does anyone know the code that lets an object appear all the time, even when scrolling?

    I have a <div> layer that I want visible at all times, even when scrolling down.

    I'm using this layer as a transparent loading layer and it will disappear when the loading is complete but right now, it seems that it can only stay at the top and when I scroll down, it just stays up there.

    I would like to know how to fill the whole background with this transparent layer or make it appear all the time.

    thanks in advance:eek:
     
    abcdefGARY, Jul 16, 2006 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    jestep, Jul 17, 2006 IP
  3. ahref

    ahref Well-Known Member

    Messages:
    1,123
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    170
    #3
    try this code
    <style>
    .flot
    {
    position:absolute;
    top:50; // change this number accordingly
    left:50; // as above
    }
    </style>
    <div class=flot> your object</div>
     
    ahref, Jul 17, 2006 IP
  4. abcdefGARY

    abcdefGARY Well-Known Member

    Messages:
    665
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    110
    #4
    ahref: I'm using position: absolute at the moment, but it doesn't work.

    however, the javascript tutorial uses position: fixed and it works. but like they said, it doesn't work in IE...

    is there a workaround that lets it work in IE :S

    thanks in advance
     
    abcdefGARY, Jul 17, 2006 IP
  5. abcdefGARY

    abcdefGARY Well-Known Member

    Messages:
    665
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    110
    #5
    Never mind. I found some position: fixed workarounds on google.
     
    abcdefGARY, Jul 17, 2006 IP
  6. slickricky

    slickricky Active Member

    Messages:
    240
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #6
    Do you mean like the feed back image on this page?
    http://robinson.slickricky.com/

    Here's the code:

    <script>
    if (!document.layers)
    document.write('<div id="divStayTopLeft" style="position:absolute">')
    </script>

    <layer id="divStayTopLeft">
    <!-- PUT YOUR IMAGE URL HERE -->
    <a href="#" TARGET="_blank"><img src="url_to_your_image.gif" alt="" border="0"></a>

    <script type="text/javascript">

    var verticalpos="frombottom"

    if (!document.layers)
    document.write('</div>')

    function JSFX_FloatTopDiv()
    {
    var startX = 740,
    startY = 300;
    var ns = (navigator.appName.indexOf("Netscape") != -1);
    var d = document;
    function ml(id)
    {
    var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
    if(d.layers)el.style=el;
    el.sP=function(x,y){this.style.left=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)/8;
    }
    else{
    var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
    ftlObj.y += (pY - startY - ftlObj.y)/8;
    }
    ftlObj.sP(ftlObj.x, ftlObj.y);
    setTimeout("stayTopLeft()", 10);
    }
    ftlObj = ml("divStayTopLeft");
    stayTopLeft();
    }
    JSFX_FloatTopDiv();
    </layer>

    </script>
     
    slickricky, Jul 17, 2006 IP
  7. slickricky

    slickricky Active Member

    Messages:
    240
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #7
    slickricky, Jul 17, 2006 IP