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
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: 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
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>
Ahh, sorry. I think you might have meant something like the purple tree on the left of this page: http://www.slickricky.com/ That's just fixed positioning using css... something like this: http://www.w3schools.com/css/tryit.asp?filename=trycss_background-attachment