Board logo

標題: IE6 PNG 修正 DD_belatedPNG [打印本頁]

作者: kayin    時間: 2012-1-19 11:25 AM     標題: IE6 PNG 修正 DD_belatedPNG

推薦一個IE6對png圖片透明的最佳解決辦法,就是使用DD_belatedPNG javacrpt代碼。
作者網站: http://www.dillerdesign.com/experiment/DD_belatedPNG/
下載地址: http://www.dillerdesign.com/expe ... edPNG_0.0.8a-min.js
或是由附件下載: [attach]95[/attach]

使用方法:
在頁面中引用代碼:
  1. <!–[if IE 6]>
  2. <script type=」text/javascript」 src=」下載下來的JS路徑」></script>
  3. <script>
  4. DD_belatedPNG.fix(『CSS選擇器, 應用類型』);
  5. </script>
  6. <![endif]–>
複製代碼
引用函數是 DD_belatedPNG.fix() , 括號裡分別填寫應用PNG的CSS選擇器(可使用ID選擇器和類選擇器)和應用類型(分為img和background兩種)。

如DD_belatedPNG.fix(『#box-one, img') 或者 DD_belatedPNG.fix(『.header, background') 等。

這些可以簡寫成 DD_belatedPNG.fix(『#box-one, .header, img,background');  。

更多選擇器的如 DD_belatedPNG.fix(『#box-one, .header,#footer,.box-two a:hover, img,background');  等等。

另外,為解決IE6下背景圖閃爍,可以在頁面中添加如下腳本
  1. <!–[if IE 6]>
  2. <script type=」text/javascript」>
  3. // <![CDATA[
  4. if((window.navigator.appName.toUpperCase().indexOf("MICROSOFT")>=0)&&(document.execCommand))
  5. try{
  6. document.execCommand("BackgroundImageCache", false, true);
  7. }
  8. catch(e){}
  9. // ]]>
  10. </script>
  11. <![endif]–>
複製代碼





歡迎光臨 Kuroshio Ocean Design - 黑潮設計 (http://forum.kod.tw/) Powered by Discuz! 7.2