Helpful Information
 
 
Category: JavaScript programming
Layer as static

Hello there. I was just wondering if there is any way to make an entire layer remain static on the screen? I know how to do it with just an image but I need to be able to do it with an entire layer and I haven't been able to figure it out. As always, any help is much apreciated.

-Nick

For Gecko (NS6+, Mozilla, etc) and Opera 6:

.static {
position: fixed;
left: 5px;
top: 5px;
}

for example.

For IE, you're going to need to use a setInterval() and some Javascript - I've recently experiemented with the expression() property, but the recalculation engine does not seem to appreciate document.body.scrollLeft and document.body.scrollTop...

for internet explorer:


<span id="staticcombo" style="position:absolute;left:0;top:0;visibility:hidden">
<P> this is static</P>
</span>
<script language="JavaScript1.2">
var combowidth=''
var comboheight=''

function initialize(){
if (document.all){
combowidth=staticcombo.offsetWidth
comboheight=staticcombo.offsetHeight
setInterval("staticit_ie()",50)
staticcombo.style.visibility="visible"
}
else if (document.layers){
combowidth=document.staticcombo.document.width
comboheight=document.staticcombo.document.height
setInterval("staticit_ns()",50)
document.staticcombo.visibility="show"
}
}

function staticit_ie(){
staticcombo.style.pixelLeft=document.body.scrollLeft+document.body.clientWidth-combowidth-30
staticcombo.style.pixelTop=document.body.scrollTop+document.body.clientHeight-comboheight
}

function staticit_ns(){
document.staticcombo.left=pageXOffset+window.innerWidth-combowidth-30
document.staticcombo.top=pageYOffset+window.innerHeight-comboheight
}

window.onload=initialize
</script>










privacy (GDPR)