osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 
 

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 ...


Go Back   osCommerce and osCMax shopping cart software forums > osCMax v1.7 Forums > osCMax v1.7 Discussion

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Closed Thread

 

LinkBack Thread Tools
  #1  
Old 10-09-2003, 03:12 AM
Member
 
Join Date: Dec 2002
Location: Byron Bay, Australia
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
starchild
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Sponsored Links
Advertisement
  #2  
Old 10-10-2003, 05:34 AM
Member
 
Join Date: Dec 2002
Location: Byron Bay, Australia
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
starchild
Default

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

tim
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #3  
Old 10-10-2003, 08:34 AM
michael_s's Avatar
osCMax Developer

 
Join Date: Jul 2002
Location: Phoenix, AZ
Posts: 11,083
Thanks: 81
Thanked 348 Times in 327 Posts
Rep Power: 10
michael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond repute
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 Templates - Hundreds of premium quality templates designed for osCMax 2. Loyalty discounts up to 30% off!
    Each purchase supports the osCMax project with much needed funds!

  • xShop for osCMax - Windows Based osCMax administration. Improved workflow, security, speed and convenience.

  • osCMax Hosting - From basic hosting to High Availability, Load Balanced arrays, the most experienced osCMax host. Default multi server configuration for exceptional performance!

  • osCMax Template Tutorial - Learn how to make your own custom templates and how to use the powerful features of the osCMax template system.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #4  
Old 10-11-2003, 06:14 AM
Member
 
Join Date: Dec 2002
Location: Byron Bay, Australia
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
starchild
Default

thanks msasek.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Sponsored Links
Advertisement
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Background Image Studio143 osCMax v1.7 Discussion 5 01-02-2005 05:26 PM
background image has dissappeared , help acrylictribesmen osCMax v1.7 Discussion 5 07-03-2004 10:55 PM
background image outside mainpage? jloyzaga osCMax v1.7 General Mods Discussion 1 01-20-2004 02:56 AM
Background Image jan_mull osCMax v1.7 Discussion 3 11-10-2003 07:31 AM
Column_left background image rd42 osCommerce 2.2 Modification Help 4 07-14-2003 12:24 AM


All times are GMT -8. The time now is 11:36 AM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
http://www.oscmax.com/forums/
Copyright 2008 osCMax