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

IE6 PNG Fix

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 07-06-2008, 06:49 PM
 
admin@centrihost.com admin@centrihost.com is offline
 

Newbie
  
Join Date: Feb 2007
Posts: 1
 

Default IE6 PNG Fix

Hello, I'm attempting to use a couple of transparent PNG's and the usual fixes don't seem to work for some reason. Anyone have any ideas?

I'm using Version 4.1.10 for this cart.

Thanks!
Reply With Quote
  #2  
Old 07-07-2008, 05:50 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default Re: IE6 PNG Fix

Quote:
Originally Posted by admin@centrihost.com
Hello, I'm attempting to use a couple of transparent PNG's and the usual fixes don't seem to work for some reason. Anyone have any ideas?

I'm using Version 4.1.10 for this cart.

Thanks!

Var. 1. Exampl. for background in css file...
PHP Code:
.test
{  
    
backgroundurl('images/test.png');
    
background-repeatno-repeat;
    -
background-imagenone;
    -
filterprogid:DXImageTransform.Microsoft.AlphaImageLoader(src=skin1/images/test.png,sizingMethod=crop);



Var 2. Png images.

Example:
PHP Code:
<img src="{$ImagesDir}/shadow.png"  style="BEHAVIOR: url({$ImagesDir}/png.htc);" /> 


Create a new file "skin1/images/png.htc":
PHP Code:
<public:component>
<public:
attach event="onpropertychange" onevent="propertyChanged()" />
<
script>
var 
supported = /MSIE (5\.5)|[6789]/.test(navigator.userAgent) && navigator.platform == "Win32";
var 
realSrc;
var 
blankSrc "skin1/images/spacer.gif";

if (
supportedfixImage();

function 
propertyChanged() {
   if (!
supported) return;
   
   var 
pName event.propertyName;
   if (
pName != "src") return;
   
// if not set to blank
   
if ( ! new RegExp(blankSrc).test(src))
      
fixImage();
};

function 
fixImage() {
   
// get src
   
var src element.src;

   
// check for real change
   
if (src == realSrc) {
      
element.src blankSrc;
      return;
   }

   if ( ! new 
RegExp(blankSrc).test(src)) {
      
// backup old src
      
realSrc src;
   }
   
   
// test for png
   
if ( /\.png$/.testrealSrc.toLowerCase() ) ) {
      
// set blank image
      
element.src blankSrc;
      
// set filter
      
element.runtimeStyle.filter "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" +
                                     
src "',sizingMethod='scale')";
   }
   else {
      
// remove filter
      
element.runtimeStyle.filter "";
   }
}

</
script>
</public:
component
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 02:01 PM.

   

 
X-Cart forums © 2001-2020