...

View Full Version : Layer TOP LEFT works in IE not in Netscape



astro_sk
10-01-2003, 07:31 PM
ok I have a layer called staticbanner

I want it to stay in the top left corner at all times including page scroll. The script below works in ie but not netscape or mozzila.


var setleft=0
var offsettop=0

var ns4=document.layers?1:0
var ie4=document.all?1:0
var ns6=document.getElementById&&!document.all?1:0


if (ie4) {staticbanner.style.pixelTop=document.body.scrollTop+offsettop;
staticbanner.style.pixelLeft=document.body}
else if (ns6) {document.getElementById("staticbanner").style.top=window.pageYOffset+offsettop;
document.getElementById("staticbanner").style.left=window.pageXOffset}
else if (ns4) {eval(document.staticbanner.top=eval(window.pageYOffset+offsettop));
eval(document.staticbanner.left=eval(window.pageXOffset))}
else{document.getElementById("staticbanner").style.top=window.pageYOffset+offsettop;
document.getElementById("staticbanner").style.left=window.pageXOffset}



any ideas? oh by the way I can not use the setTimeout as it causes a problem with my other scripts.....

thanx in advance

Skyzyx
10-02-2003, 02:38 AM
If you can't use setTimeout, you may be S.O.L. However, in newer versions of Gecko (Mozilla 1.2-ish and Netscape 7.1) it supports the CSS2 property position:fixed.



#staticbanner {
position:fixed;
}


It should work...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum