Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Layer TOP LEFT works in IE not in Netscape

    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.
    Code:
    	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
    ¼^⌠";....astro....;"⌠^¼

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    Silicon Valley, CA
    Posts
    980
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

    Code:
    #staticbanner {
    	position:fixed;
    }
    It should work...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •