菜单

how to get a js png fix to work on ajax calls

2011年06月15日 - css

If you are using iepngfix.htc, you might try setting the behavior inline

var myEl = document.getElementById('inbound-ajax-element');
myEl.style.behavior = 'url(iepngfix.htc)';

http://www.twinhelix.com/css/iepngfix/demo/

 

You should take a look here jQuery IE PNG Fix Plugin

jQuery(function($) {
    $("img[@src$=png], #image-one, #image-two").pngfix();
});

You should run this on the images you just loaded.

 

demo:

 

function filterAlphaImages(){
	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);
	if (itsAllGood) {
		for (var i=0; i<document.all.length; i++){
			var obj = document.all[i];
			var bg = obj.currentStyle.backgroundImage;
			var img = document.images[i];
			if (bg && bg.match(/\.png/i) != null) {
			var img = bg.substring(5,bg.length-2);
			var offset = obj.style["background-position"];
			obj.style.filter =
			"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img+"', sizingMethod='crop')";
			obj.style.backgroundImage = "url('fileadmin/templates/images/pixel.gif')";
			obj.style["background-position"] = offset; // reapply
			} else if (img && img.src.match(/\.png$/i) != null) {
			var src = img.src;
			img.style.width = img.width + "px";
			img.style.height = img.height + "px";
			img.style.filter =
			"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='crop')"
			img.src = "fileadmin/templates/images/pixel.gif";
			}
		}
	}
}

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注