Today, we have found a very simple and useful code snippet on snipplr.com with which you can use in old browsers Internet Explorer 5 and 6 the PNG support, and their real transparency.
It simply requires a JavaScript in the head of the HTML code which is based on the loaded HTML page for all existing PNG image files and analyzed them in a SPAN with the effective converts PNG transparency.
With the Conditional days to ensure that this is only in browsers that do not support PNG as Internet Explorer (5.x and 6.x) is loaded: lt if
\u0026lt;!--[ IE 7]> Send "
src="/_local/templates/scripts/pngsupporter.js"> \u0026lt;/ script>
\u0026lt;[endif] ->
This modification this in our CMS and otherwise a little better and is applied correctly, this was modified by us anything.
File pngsupport.js with PNG support function is as follows:
correctPNG function () {handle
/ * correctly PNG transparency in Win IE 5.5 & 6
http://snipplr.com/view/8637/png-support--no-other-files-needed/ * / var
arVersion navigator.appVersion.split = ("MSIE");
was version = parseFloat (full version or upgrade sion [1]);
if ((version> = 5.5) & & (document.body.filters)) {
for (var i = 0; i \u0026lt;document.images.length ; i + +) {img =
was document.images [i];
was imgName img.src.toUpperCase = ();
if (imgName.substring (imgName.length-3, imgName.length) == "PNG") {
was imgID = (img.id)? 'Id =' "+ img.id +" '":" ";
was imgClass = (img.className)? "Class = '" + img.className + "'": "";
was imgTitle = (img.title) ? 'Title =' "+ img.title +" '"' title = '" + img.alt + "'";
was 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;
was strNewHTML = "\u0026lt;span style="\\" src="'" sizingmethod="'scale');\\"> \u0026lt;/ span>";
img.outerHTML = StrNewHTML;
i = i-1;}
}}
} window.attachEvent ("onload", correctPNG) Please do
is still valid, that the appropriate level with the PNG image to an enclosed DIV tag is not so that the upper node set is overwritten:
\u0026lt;div>
\u0026lt;img id = "left_collage_bottom" src ="../ images / bg_collage.png "alt =" "width =" 323 "height =" 190 "/>
\u0026lt;/ div>
now appears in the PNG24 older IE6!
The original script is by conspirator to see snipplr.com:
http://snipplr.com/view/8637/png-support--no-other-files-needed/
0 comments:
Post a Comment