Fix lỗi file hình .png không trong suốt trên IE6

Thứ Sáu, 2 tháng 3, 2012

jquery.pngFix.js
PNG-Transparency for Windows IE 5.5 & 6
This plugin will fix the missing PNG-Transparency in Windows Internet Explorer 5.5 & 6. 
This page uses jQuery Version 1.3.2
Version 1.1, 2007-09-11
Tested on Windows XP SP2 with
- IE 5.5 + 6 + 7

E x a m p l e s:PNG with transparency 
<img src="pngtest.png" width="173" height="173" alt="This is the alt-Text" /> 


PNG with TITLE-Attribute 

<img src="pngtest.png" width="173" height="173" 
title="This is the title-Text" alt="This is the alt-Text" /> 


PNG within a link 

<a href="#" onclick="alert('click');return false;"> 
<img src="pngtest.png" width="173" height="173" 
title="This is the title-Text" alt="This is the alt-Text" /> 
</a> 


PNG within a link and a STYLE-Attribute 

<a href="#" onclick="alert('click');return false;"> 
<img src="pngtest.png" width="173" height="173" 
style="border:1.0em dashed #090;padding:10px;margin:10px;" 
title="This is the title-Text" alt="This is the alt-Text" /> 
</a> 


Div with PNG-Background via CSS 

<div> 
<div style="float:left;width:173px;height:173px; 
background: url(pngtest.png);"> 
This is a div-Container using a png as background ... 
</div> 
<div style="float:right;width:346px;height:346px; 
background: white url(pngtest.png);"> 
This is a div-Container using a png as background ... 
</div> 
<div style="clear:both;"></div> 
</div> 


This is a div-Container using a png as background ...
This is a div-Container using a png as background ...


Input with PNG-Source 

<form> 
<input type="image" src="pngtest.png" width="173" height="173" /> 
</form> 



How to use jquery.pngFix.js

1.

2.
Add jQuery and pngFix to the HEAD-Section of your HTML ...<head> 
... 
<script type="text/javascript" src="jquery-latest.pack.js"></script> 
<script type="text/javascript" src="jquery.pngFix.js"></script> 
... 
</head>


3.
Activate pngFix on document.ready 
<head> 
... 
<script type="text/javascript"> 
$(document).ready(function(){ 
$(document).pngFix(); 
}); 
</script> 
... 
</head>


Test PNG (without transparency in IE 5.5 & 6)

Xem thêm bài viết cùng chuyên mục:

Ý kiến bạn đọc [ 0 ]


Ý kiến của bạn