I need help PNGfix code

Discussion in 'JavaScript' started by Crazace2006, Jan 5, 2008.

  1. #1
    I am using a PNG file on www.leftystrats.com and want to use the PNGfix code. I found a script at http://snipplr.com/view.php?codeview&id=4251. Here is the code:


    I have little experience with javascript, so I was wonder what need to go into that javascript file. My PNG image is 429 x 126px and located at http://www.leftystrats.com/logo.png.
     
    Crazace2006, Jan 5, 2008 IP
  2. hogan_h

    hogan_h Peon

    Messages:
    199
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You don't need any further modifications inside the code. Create new file named pngfix.js and paste the script content into it. Copy that file into "scripts" folder.

    Then in your html page edit the head tag and add the <script> tags to include the js file. Your head tag should look like this:
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Left Handed Stratocasters - Lefty Guitars, Parts, &amp; Forum</title>
    <meta name="keywords" content="Lefty, Left Handed, Fender Stratocaster, Southpaw, Mexican, Deluxe, American, Strat, Custom Shop" />
    <meta name="description" content="Find or build the Lefty Stratocaster of your dreams." />
    
    <style type="text/css">
    <!--
    body {
    	background-image: url(BackGround.jpg);
    }
    -->
    </style>
    <link href="Lfont.css" rel="stylesheet" type="text/css" />
    <script language="JavaScript" type="text/javascript" src="scripts/pngfix.js"></script>
    
    <!--[if lt IE 7]>
    <script defer type="text/javascript" src="scripts/pngfix.js"></script>
    <![endif]-->
    </head>
    
    Code (markup):
    It is mentioned that the image should have dimensions declared, and your logo has width and height defined, so it should be ok.
    Personally, i don't like that solution or any other js based solution, this one will probably mess with all png images on the website, i would rather just replace the png logo with gif one.
     
    hogan_h, Jan 5, 2008 IP
  3. Crazace2006

    Crazace2006 Active Member

    Messages:
    143
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    The logo is the only PNG on the entire page, so would that still be a problem?
     
    Crazace2006, Jan 5, 2008 IP
  4. hogan_h

    hogan_h Peon

    Messages:
    199
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    0
    #4
    In that case, it should be ok ;)
     
    hogan_h, Jan 5, 2008 IP
  5. Andrei P.

    Andrei P. Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Andrei P., Jan 7, 2008 IP