PDA

View Full Version : Forum Home Enhancements - fix png transparency


RC.
05-25-2008, 10:00 PM
this code fix the png transparency problems whit ie5 and ie 6

this is very simple:
in the header template add this code very top:



<!--[if gte IE 5.5000]>
<script language="JavaScript">
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
{
for(var i=0; i<document.images.length; i++)
{
var img = document.images[i]
var imgName = img.src.toUpperCase()
if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
{
var imgID = (img.id) ? "id='" + img.id + "' " : ""
var imgClass = (img.className) ? "class='" + img.className + "' " : ""
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
var imgStyle = "display:inline-block;" + img.style.cssText
if (img.align == "left") imgStyle = "float:left;" + imgStyle
if (img.align == "right") imgStyle = "float:right;" + imgStyle
if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
+ "filter:progid:DXImageTransform.Microsoft.AlphaImag eLoader"
+ "(src=\'" + img.src + "\');\"></span>"
img.outerHTML = strNewHTML
i = i-1
}
}
}
window.attachEvent("onload", correctPNG);
</script>
<![endif]-->





If you Like This Mod Mark INSTALLED (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=180509)

enjoy

dvbusuario
05-26-2008, 01:04 AM
Install!!

Bonus Paradise
05-26-2008, 06:26 AM
thank you for that! :)

Silvio
05-26-2008, 10:31 AM
ty sir! *installed

echo2kk5
05-26-2008, 03:32 PM
Does this work with 32 bit PNG images as well?

OcR Envy
05-27-2008, 09:53 AM
Any problems with width/height going crazy? I've tried other png ie fixes that worked but had issues.

Wayne Luke
05-27-2008, 02:35 PM
This solution is more elegant, less resource intensive and still valid:

https://vborg.vbsupport.ru/showthread.php?t=94416

Just by placing the javascript in an external file, you can significantly reduce page load and bandwidth simply because its cached in the end-user's browser. Not only that but IE7 and IE8 do not need this applied to PNG images since they support the Alpha Transparency natively.

OsiRiS_X
06-20-2008, 04:28 PM
Install, Very Nice!

kencasanova
06-21-2008, 04:16 PM
it doesn't work with mine. help!

CMGU
06-21-2008, 05:08 PM
doesn't work for me

mesdar
12-12-2008, 05:59 AM
thanks

installed