Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Sizing Pictures to reflect Monitor Resolutions.

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 05-04-2006, 03:23 PM
 
syllogism syllogism is offline
 

Newbie
  
Join Date: May 2006
Location: London, Ontario, Canada
Posts: 2
 

Default Sizing Pictures to reflect Monitor Resolutions.

I was told not to write HELP in the Subject Area. So here goes HELP!
I am using Flexy Rectangles which has a photo (main_bg_1.jpg 1000 x 132). If my monitor setting is 1024 x 768 then I see only 70% (approx) of photo. If the setting is 800 x 600 then I see even less and with 1280 x 1024 then I see everything. I need a simple solution that will accomodate a customer regardless of his/her monitor setting. I suspect the solution may require that I create 3 images (which is fine) but I need to know the IF/ELSE logic that will recognize the monitor setting.

If anyone can help I would be most appreciative.
__________________
syllogism
Version 4.0.18
XC - Flexy Rectangles
Reply With Quote
  #2  
Old 05-04-2006, 04:48 PM
  Zaja's Avatar 
Zaja Zaja is offline
 

X-Adept
  
Join Date: Mar 2004
Location: The Universe is my home
Posts: 420
 

Default

Try following:

1. Head:
Code:
<script type="text/javascript"> //<![CDATA[ {literal} var w=screen.width; var h=screen.height; function resolution() { if((w==800)&&(h==600)) { document.getElementById('point').src='skin1/images/800_600_bg.jpg'; } else if((w==1024)&&(h==768)) { document.getElementById('point').src='skin1/images/1024_768_bg.jpg'; } else if((w==1152)&&(h==864)) { document.getElementById('point').src='skin1/images/1152_864_bg.jpg'; } else if((w==1280)&&(h==960)) { document.getElementById('point').src='skin1/images/1280_960_bg.jpg'; } else if((w==1280)&&(h==1024)) { document.getElementById('point').src='skin1/images/1280_1024_bg.jpg'; } } onload=resolution; {/literal} //]]> </script>

2. Body:
Code:
<div>[img]skin1/images/main_bg.jpg[/img]</div>
__________________
_/ _/ _/ _/ _/ _/ _/ _/ _/

7dana.com
Reply With Quote
  #3  
Old 05-06-2006, 09:41 AM
 
syllogism syllogism is offline
 

Newbie
  
Join Date: May 2006
Location: London, Ontario, Canada
Posts: 2
 

Default Sizing Pictures to reflect Monitor Resolutions.

Many Thanks to Zaja for supplying this code that worked for me in the Home.tpl of the Flexy Rectangles template re the picture main_bg_1.jpg. The idea was to display a diferent version (size) of the same picture depending upon the resolution of the viewing monitor.

2. header code:
Code:
<script type="text/javascript">
//<![CDATA[
{literal}

var w=screen.width;
var h=screen.height;

function resolution() {
if((w==800)&&(h==600)) {
document.getElementById('point').background='skin1 /images/custom/800_600_bg.jpg';
}
else if((w==1024)&&(h==76) {
document.getElementById('point').background='skin1 /images/custom/1024_768_bg.jpg';
}
else if((w==1152)&&(h==864)) {
document.getElementById('point').background='skin1 /images/custom/1152_864_bg.jpg';
}
else if((w==1280)&&(h==960)) {
document.getElementById('point').background='skin1 /images/custom/1280_960_bg.jpg';
}
else if((w==1280)&&(h==1024)) {
document.getElementById('point').background='skin1 /images/custom/1280_1024_bg.jpg';
}
}
onload=resolution;

{/literal}
//]]>
</script>

3. Table code:
Code:
<table id="point" width="100%" border="0" cellpadding="0" cellspacing="0" background="skin1/images/default_bg.jpg" class="MainImageBackground">
__________________
syllogism
Version 4.0.18
XC - Flexy Rectangles
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 05:24 PM.

   

 
X-Cart forums © 2001-2020