Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • teddirez Friend
    #116843

    Just thought this may be of use to others that are using PNG files in their sites that have transparent backgrounds. Firstly open your fave editor and paste:

    var arVersion = navigator.appVersion.split("MSIE")
    var version = parseFloat(arVersion[1])

    if ((version >= 5.5) && (document.body.filters))
    {
    for(var i=0; i<document.images.length; i++)
    {
    var img = document.images
    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.AlphaImageLoader"
    + "(src='" + img.src + "', sizingMethod='scale');"></span>"
    img.outerHTML = strNewHTML
    i = i-1
    }
    }
    }

    save this file as pngfix.js
    then somewhere in the head tags of your index.php file add

    <!-->
    <script defer type="text/javascript" src="<?php echo $mosConfig_live_site;?>/templates/ja_pluto_ex/scripts/pngfix.js"></script>
    <!-->

    this will fix the pinkish background you get.

    Don’t forget if you want to package and upload the template as a whole zip file, put the js file in the scripts folder and add the line

    <filename>scripts/pngfix.js</filename>

    to your templateDetails.xml file between the files tags.

    You could do this to any template just change the name of the template in the index.php part of the code.

    This issue has apparently been fixed in IE7 but until that comes out this is a temp fix and only very small. Personally i think everyone should just use Opera :p

    samedbeyribey Friend
    #209701

    thank you that’s useful
    i know a mambot that does same thing 🙂

    Hung Dinh Friend
    #209705

    teddirez, thank you for the very helpful post

Viewing 3 posts - 1 through 3 (of 3 total)

This topic contains 3 replies, has 3 voices, and was last updated by  Hung Dinh 18 years, 4 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum