Fix png issue for jQuery fadeIn()/fadeOut() effect IE7

When we use jQuery fadeIn() or faeOut() function with transparent png image, in IE7 we get a weird borer around it. There are many solutions for it, but we cant say that all of those are okay to everyone. This one works for me and some other guys. Call the following function in document load.


function pngFixForIE()

{

	var i;
	for (i in document.images) {
		if (document.images[i].src) {
			var imgSrc = document.images[i].src;
			if (imgSrc.substr(imgSrc.length-4) === '.png' || imgSrc.substr(imgSrc.length-4) === '.PNG') {
				document.images[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='crop',src='" + imgSrc + "')";
			}
		}
	}

}

You may also read:  An awesome plugin – Meet the team – WordPress Plugin

You may also like...

Leave a Reply

%d bloggers like this: