close

敬告遊客:
以下內容枯燥無聊,若情非得已不建議進入。
若仍執意進入,當有頭暈嘔吐現象時請盡速離開本篇文章。

 

公司的電腦超爛,所以我的瀏覽器一直停留在IE6,我不敢升級,只怕升到了IE7,我那跑到極限的SDRAM就給我抗議罷工。偏偏這次客戶要求用PNG檔,還給我每張圖都來個透明背景,讓我這次真的躲不掉非要面對這個問題了。

 

上網查到了很多人分享方法,如下:

1.IE PNG Fix 2.0 Alpha 4
http://www.twinhelix.com/css/iepngfix/

 

 

最多人提到此方法,我也是用此方法解決的,很好用耶~他的概念就是在CSS中導入HTC檔案。
把iepngfix.zip下載下來後,解壓縮打開,就可以看到iepngfix.html,接著用IE打開此網頁,就可以看到他的安裝說明了。
1.Copy and paste iepngfix.htc and blank.gif into your website folder.
2.Copy and paste this into your website's CSS or HTML:

img, div { behavior: url(iepngfix.htc) }

3.If your site uses subfolders, open the .HTC file in a text editor like Windows Notepad and change the blankImg variable to include a correct path to blank.gif like so:
IEPNGFix.blankImg = '/images/blank.gif';



當然我也要紀錄一下我的方法,方法就跟上面的一模一樣

1.把iepngfix/iepngfix.htc放入www/html資料夾中
HTC (HTML Component),其中包含Javascript。
 

2.因為我目前只需針對<img src="xxx/aaa.png"></img>處理
在我的css檔案中加入img{ behavior: url(/filepath/iepngfix.htc) }
 

3.因我自己有空白圖檔space.gif,所以更改iepngfix.htc中的IEPNGFix.blankImg = thisFolder + 'blank.gif';
==>IEPNGFix.blankImg = 'filepath/space.gif';
若是不改成我們的空白圖檔,讓server找不到blank.gif的話,每張圖就會出現叉叉唷

 

 

2.ie7-js
http://code.google.com/p/ie7-js/

這個方法也超簡單的啦~只是我跑起來會怪怪的,但是測試起來很快唷~他名字的意思就是讓IE5.5-6升級到就像IE7一樣啦~
 

 

下載頁面:http://code.google.com/p/ie7-js/downloads/list

把IE7-2.1(beta3).zip下載,解壓縮打開,就會看到IE7.js
1.把IE7.js放入www/html資料夾中
2.If you want the fix to apply to all PNG images then set a global variable as follows:
var IE7_PNG_SUFFIX = ".png";
You must set this variable before including the IE7.js script. Alternatively, you can set the variable inside the IE7.js script element:

< script src="IE7.js" >IE7_PNG_SUFFIX=".png";< /script >


就這樣兩步,我們就做完了~



==更多資訊==

1.mcda warehouse
http://blog.xuite.net/mcda/warehouse/17182144

2.The Will Will Web
http://blog.miniasp.com/post/2008/07/Fix-IE-PNG-Transparency-Problem-in-IE-5-6.aspx

 


arrow
arrow
    全站熱搜

    calories 發表在 痞客邦 留言(0) 人氣()