SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Centering a layer in NN4

    I have this script that I got from some free JS site somewhere. Does anyone know why it doesn't work in NN4?

    Code:
    n = (document.layers) ? 1:0
    ie = (document.all) ? 1:0
    
    if (n) {
    	windowWidth = window.innerWidth-16
    	windowHeight = window.innerHeight
    }
    if (ie) {
    	windowWidth = document.body.offsetWidth-20
    	windowHeight = document.body.offsetHeight
    }
    
    document.writeln('<STYLE TYPE="text/css">');
    document.writeln('<\!--');
    document.writeln('#centerLayer {position:absolute; left:'+(windowWidth/2-780/2)+'; top:'+(windowHeight/2-440/2)+'; width:780; height:440; clip:rect(0,780,440,0); background-image: url(img/bg.gif); background-color: #FFFFFF; z-index:1' );
    document.writeln('-->');
    document.writeln('</STYLE>');
    Thanks.

    G

  2. #2
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmmmmmm .... I'm getting the distinct impression that no one uses this particular corner of SitePoint yet .....

    Anyways. Sussed that. Sloppy CSS in the original script -- a missing '}'. I have a new problem though with the font classes now. They keep their class for a fraction of a second, but as soon as the page finishes loading and renders itself the fonts lose all formatting. Bloody NN4!!!



Bookmarks

Posting Permissions

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