We Recommend

Pro JavaScript Techniques Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.


Posted By

giannim on 07/08/06


Tagged

fix ie png prototype


Versions (?)


Who likes this?

28 people have marked this snippet as a favorite

luman
xaviaracil
jamesmcoats
designerd
alvaroisorna
mate
gardano
postNuKe
jakedahn
panatlantica
jkochis
Taleamus
elegantd
dertimbo
j4k
millisami
ttscoff
visualAesthetic
Hirmine
rnrleachryan
gbvb
ohmygowda
hudge
SamuelMiller
vilebender
Mithun
zeljkoprsa
JimiJay


IE 5.5 & IE6 PNG Transparency Fix (Prototype required)


Published in: JavaScript 


  1. // this will iterate with each element with the class 'ie-fix-opacity' and add an IE filter,
  2. // replacing the background-image for the filter of that image
  3. var version = parseFloat(navigator.appVersion.split('MSIE')[1]);
  4. if ((version >= 5.5) && (version < 7) && (document.body.filters)) {
  5. document.getElementsByClassName('ie-fix-opacity').each(function(poElement){
  6. // if IE5.5+ on win32, then display PNGs with AlphaImageLoader
  7. var cBGImg = poElement.currentStyle.backgroundImage;
  8. var cImage = cBGImg.substring(cBGImg.indexOf('"') + 1, cBGImg.lastIndexOf('"'));
  9.  
  10. poElement.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + cImage + "', sizingMethod='scale')";
  11. poElement.style.backgroundImage = "none";
  12. });
  13. }

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: alvaroisorna on July 27, 2006

hey! this is the same as my scriplet!! please at least make a comment about it..

http://snipplr.com/view/125/png-opacity-support-for-internet-explorer-simplified/

You need to login to post a comment.