osCmax v2.5 User Manual
Results 1 to 4 of 4

background image stretch- how to modify this script?

This is a discussion on background image stretch- how to modify this script? within the osCmax v1.7 Discussion forums, part of the osCmax v1.7 Forums category; hi there, I found this script that allows a background image to stretch according to the size of the page ...

      
  1. #1
    Member
    Join Date
    Dec 2002
    Location
    Byron Bay, Australia
    Posts
    45
    Rep Power
    0


    Default background image stretch- how to modify this script?

    hi there,

    I found this script that allows a background image to stretch according to the size of the page - how do i integrate this into OSCMAX_1.5.....i'm assuming it goes into main_page.tpl, but how I'm not sure. Anyone any ideas?

    here's the script------------>


    <html>
    <HEAD>
    <SCRIPT LANGUAGE="JavaScript1.2">
    <!--
    NS4 = (document.layers);
    IE4 = (document.all);

    scaleWidth = true;
    scaleHeight = true;
    imSRC = "background.jpg";

    if (NS4) window.onload = setResize;

    function setResize(){
    setTimeout("window.onresize=reDo;",500);
    }

    function reDo(){
    window.location.reload()
    }

    if (IE4) window.onresize = reDoIE;

    function reDoIE(){
    imBG.width = document.body.clientWidth;
    // imBG.height = document.body.clientHeight;
    }

    function makeIm() {

    winWid = (NS4) ? innerWidth : document.body.clientWidth;
    // winHgt = (NS4) ? innerHeight : document.body.clientHeight;

    imStr = "<DIV ID=elBGim"
    + " STYLE='position:absolute;left:0;top:0;z-index:-1'>"
    + "<IMG NAME='imBG' BORDER=0 SRC=" + imSRC;
    if (scaleWidth) imStr += " WIDTH=" + winWid;
    // if (scaleHeight) imStr += " HEIGHT=" + winHgt;
    imStr += "></DIV>";

    document.write(imStr);

    }
    //-->
    </SCRIPT>
    </HEAD>

    <BODY MARGINHEIGHT=0 MARGINWIDTH=0>
    <SCRIPT LANGUAGE="JavaScript1.2">
    <!--
    makeIm();
    //-->
    </SCRIPT>

    <body>
    </body>
    </html>



    <---------------------end of script

    Cheers, Tim

  2. #2
    Member
    Join Date
    Dec 2002
    Location
    Byron Bay, Australia
    Posts
    45
    Rep Power
    0


    Default

    i edited the original post's script with a simpler one - but still can't integrate it. Any one any ideas?

    tim

  3. #3
    osCMax Developer

    michael_s's Avatar
    Join Date
    Jul 2002
    Location
    Phoenix, AZ
    Posts
    19,907
    Rep Power
    568


    Default

    I think you just put this code in the <head> section:

    Code:
    <SCRIPT LANGUAGE="JavaScript1.2"> 
    <!-- 
    NS4 = (document.layers); 
    IE4 = (document.all); 
    
    scaleWidth = true; 
    scaleHeight = true; 
    imSRC = "background.jpg"; 
    
    if (NS4) window.onload = setResize; 
    
    function setResize(){ 
    setTimeout("window.onresize=reDo;",500); 
    } 
    
    function reDo(){ 
    window.location.reload() 
    } 
    
    if (IE4) window.onresize = reDoIE; 
    
    function reDoIE(){ 
    imBG.width = document.body.clientWidth; 
    // imBG.height = document.body.clientHeight; 
    } 
    
    function makeIm() { 
    
    winWid = (NS4) ? innerWidth : document.body.clientWidth; 
    // winHgt = (NS4) ? innerHeight : document.body.clientHeight; 
    
    imStr = "<DIV ID=elBGim" 
    + " STYLE='position:absolute;left:0;top:0;z-index:-1'>" 
    + "<IMG NAME='imBG' BORDER=0 SRC=" + imSRC; 
    if (scaleWidth) imStr += " WIDTH=" + winWid; 
    // if (scaleHeight) imStr += " HEIGHT=" + winHgt; 
    imStr += "></DIV>"; 
    
    document.write(imStr); 
    
    } 
    //--> 
    </SCRIPT>
    And this code in the body section, where you want the image to appear:
    Code:
    <SCRIPT LANGUAGE="JavaScript1.2"> 
    <!-- 
    makeIm(); 
    //--> 
    </SCRIPT>
    I have not tried it, but it seems pretty straightforward.
    Michael Sasek
    osCMax Developer


    osCmax Installation Service
    - Have our professionals install osCmax on your server - same day service!
    osCmax 2.5 User Manual - the must have beginners guide to osCmax v2.5

    Stay Up To Date with everything osCMax:
    Free osCmax Newsletters - Security notices, New Releases, osCMax News
    osCmax on Twitter - Up to the minute info as it happens. Know it first.

    osCmax Documentation

  4. #4
    Member
    Join Date
    Dec 2002
    Location
    Byron Bay, Australia
    Posts
    45
    Rep Power
    0


    Default

    thanks msasek.

Similar Threads

  1. Background Image
    By Studio143 in forum osCmax v1.7 Discussion
    Replies: 5
    Last Post: 01-02-2005, 04:26 PM
  2. background image has dissappeared , help
    By acrylictribesmen in forum osCmax v1.7 Discussion
    Replies: 5
    Last Post: 07-03-2004, 09:55 PM
  3. background image outside mainpage?
    By jloyzaga in forum osCMax v1.7 General Mods Discussion
    Replies: 1
    Last Post: 01-20-2004, 01:56 AM
  4. Background Image
    By jan_mull in forum osCmax v1.7 Discussion
    Replies: 3
    Last Post: 11-10-2003, 06:31 AM
  5. Column_left background image
    By rd42 in forum osCommerce 2.2 Modification Help
    Replies: 4
    Last Post: 07-13-2003, 11:24 PM

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
  •