开发者

PNG Transparency in IE6 problem

开发者 https://www.devze.com 2023-01-26 23:26 出处:网络
I know this is a bit of a silly question, bu开发者_开发问答t I can\'t work out how to make a transparent PNG work in IE6. I\'ve tried several things, but they haven\'t worked. I was wondering if anyon

I know this is a bit of a silly question, bu开发者_开发问答t I can't work out how to make a transparent PNG work in IE6. I've tried several things, but they haven't worked. I was wondering if anyone could let me know of a suitable hack?

Thanks in advance,

AD72


Hey use jQueries pngFix. Works like a charm! http://jquery.andreaseberhard.de/pngFix/


have you tried this method? link text

i have tried a number of png hacks fore IE6 and this is the best one that resolves all of the problems that ie has with pngs. good luck


Here's the code we use that seems to work fine.

// from http://labs.unitinteractive.com/unitpngfix.php

var clear="/images/template/clear.gif" //path to clear.gif

pngfix=function(){var els=document.getElementsByTagName('*');var ip=/\.png/i;var i=els.length;while(i-- >0){var el=els[i];var es=el.style;if(el.src&&el.src.match(ip)&&!es.filter){es.height=el.height;es.width=el.width;es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.src+"',sizingMethod='crop')";el.src=clear;}else{var elb=el.currentStyle.backgroundImage;if(elb.match(ip)){var path=elb.split('"');var rep=(el.currentStyle.backgroundRepeat=='no-repeat')?'crop':'scale';es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path[1]+"',sizingMethod='"+rep+"')";es.height=el.clientHeight+'px';es.backgroundImage='none';var elkids=el.getElementsByTagName('*');if (elkids){var j=elkids.length;if(el.currentStyle.position!="absolute")es.position='static';while (j-- >0)if(!elkids[j].style.position)elkids[j].style.position="relative";}}}}}
window.attachEvent('onload',pngfix);


Ive used the one from TwinHelix or the jquery one mentioned above.


The PNG form of image is Post Notational Graphic and is primarily described in a law in the era of Queen Victoria of England and therefore is primarily for use in Great Britain. The software for creating and displaying a PNG image is sourced from and protected by England and the different display software versions required for all browsers and different and new browser versions and content environments may not have been commissioned to be done and the incompatibilities could persist for some time. Originally the agreement was with MS and the IE browser only for displaying PNG and it is possible a number of unofficial hacks and decodes have been developed for other browsers with varying success. PNG is officially and completely renderable only when used in a defined list of nations and provinces.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号