次のコードを使用して、IE6 の PNG の問題を修正しています (はい、IE6 を使用している訪問者もいます :( ) ... コードは .png 画像を空白の画像に置き換えているようですが、フィルタを実行していないようです適切に...失敗する可能性のある理由はありますか?ありがとう
var blank = new Image();
blank.src = 'img/blank.gif';
$(document).ready(function() {
var badBrowser = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
if (badBrowser) {
//alert('bad browser');
// get all pngs on page
$('img[src$=".png"]').each(function() {
if (!this.complete) {
this.onload = function() { fixPng(this) };
} else {
fixPng(this);
}
});
}
});
function fixPng(png) {
// get src
var src = png.src;
// set width and height
if (!png.style.width) { png.style.width = $(png).width(); }
if (!png.style.height) { png.style.height = $(png).height(); }
// replace by blank image
png.onload = function() { };
png.src = blank.src;
// set filter (display original image)
png.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
}