You are reading the Drake CMS Official Forums archive, available for historical purposes only.
Drake CMS has been rebranded into Lanius CMS, visit the new Lanius CMS Official Forums if you need support about Lanius CMS or Drake CMS -> Lanius CMS migration.
As we all know, IE6 does not display png images with transparency
very well. Since many people still browse with IE6, here is a
small bit of code that fixes that problem. I have been putting it
in the HEAD of my templates, but I'm not sure if that is the
correct way for Drake.
You must put a 1px x 1px
transparent gif image in your template images folder.
You must also give all png images with transparency a class
name of 'png'.(<img src="images/my_image.png"
class="png" />
Code:
<!--[if lt IE
7]> <script type="text/javascript"> window.onload = function(){ pngFix(); }//function //So IE6 browsers can display PNG images with
transparency function pngFix() { if(!document.all)
return; for (i=document.images.length-1;i>=0;i--){ x=document.images[i]; if(x.className=='png') {
x.style.filter="progid:DXImageTransform.Microsoft.AlphaImage
Loader(src='"+x.src+"')" x.src="images/transparent.gif";
}//if }//for }//function </script> <![endif]-->
hbryant
Re : a fix for png transparency in IE 6
10 May 2007 11:17
Anonymous
Hmmmm, but what if my png image is the banner image? I can't
give the banner image a classname of 'png' unless I modify the
banner module and I don't really want to do that.
hbryant
Re : a fix for png transparency in IE 6
10 May 2007 11:18
Anonymous
I guess I could install a new module named png_banner ??
hbryant
Re : a fix for png transparency in IE 6
10 May 2007 11:39
Anonymous
Here's a slight fix that loads the correct url for the
transparent.gif image. Code:
<!--[if lt IE 7]> <script
type="text/javascript"> window.onload =
function(){ pngFix(); }//function //So IE6
browsers can display PNG images with transparency function
pngFix() { if(!document.all) return; for
(i=document.images.length-1;i>=0;i--){
x=document.images[i]; if(x.className=='png') {
He of all things Drake coding,
legolas558, will have a comment when he has a look at your
ideas...or maybe even another one of the other devs...
Unfortunately I am but a babe in the woods amongst the Drake
code forest...
legolas558
Re : a fix for png transparency in IE 6
15 May 2007 23:55
Anonymous
Hi hbryant,
I am reading with interest your post and I
have a few things to ask you: Since we are officially
supporting IE6 and IE7, it would be great if you could report us
(through a bug tracker item and subsequent comments) about PNGs
not showing correctly in IE6 so that we will reduce their color
depth to 8bit and allow them to be displayed correctly also
there. Unfortunately we won't support CSS hacks in the core due
to their instability and anti-standard philosophy.
Quote:
I guess I could
install a new module named png_banner ??
I'd better make all the trickery using CSS rules and adding a
custom javascript.