Posted By

gdesjardins on 11/23/10


Tagged

png comment ie6 alpha conditional


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

jillella


IE6 pngfix


 / Published in: JavaScript
 

requires an existing image on path -> images/transparent.gif

  1. <!--[if lt IE 7]>
  2. <style>
  3. .png {
  4. behavior: expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
  5. this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='image')",
  6. this.src = 'images/transparent.gif'):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
  7. this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "', sizingMethod='scale')",
  8. this.runtimeStyle.backgroundImage = "none")),this.pngSet=true)
  9. );
  10. }
  11. </style>
  12. <![endif]-->

Report this snippet  

You need to login to post a comment.