Return to Snippet

Revision: 98
at July 10, 2006 03:35 by alvaroisorna


Updated Code
//	this script have dependencies on prototype-1.4.0.js and Browser Detect Lite  v2.1
//	http://prototype.conio.net/
//	http://www.dithered.com/javascript/browser_detect/index.html
//	(cc) alvaro isorna

Event.observe(window, 'load', function(){
	//	this will iterate with each element with the class 'ie-fix-opacity' and add an IE filter,
	//	replacing the background-image for the filter of that image
	document.getElementsByClassName('ie-fix-opacity').each(function(poElement){
		// if IE5.5+ on win32, then display PNGs with AlphaImageLoader
		if ((browser.isIE55 || browser.isIE6up) && browser.isWin32){
			var cBGImg = poElement.currentStyle.backgroundImage;
			var cImage = cBGImg.substring(cBGImg.indexOf('"') + 1, cBGImg.lastIndexOf('"'));
					
			poElement.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + cImage + "', sizingMethod='scale')";
			poElement.style.backgroundImage = "none";
		}
	});
}, false);

Revision: 97
at June 30, 2006 05:11 by alvaroisorna


Initial Code
//	this script have dependencies on prototype-1.4.0.js and Browser Detect Lite  v2.1
//	http://prototype.conio.net/
//	http://www.dithered.com/javascript/browser_detect/index.html

Event.observe(window, 'load', function(){
	//	this will iterate with each element with the class 'ie-fix-opacity' and add an IE filter,
	//	replacing the background-image for the filter of that image
	document.getElementsByClassName('ie-fix-opacity').each(function(poElement){
		// if IE5.5+ on win32, then display PNGs with AlphaImageLoader
		if ((browser.isIE55 || browser.isIE6up) && browser.isWin32){
			var cBGImg = poElement.currentStyle.backgroundImage;
			var cImage = cBGImg.substring(cBGImg.indexOf('"') + 1, cBGImg.lastIndexOf('"'));
					
			poElement.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + cImage + "', sizingMethod='scale')";
			poElement.style.backgroundImage = "none";
		}
	});
}, false);

Initial URL


Initial Description
first try to a crossbrowser support for png's opacity support

Initial Title
PNG Opacity support for Internet Explorer (simplified)

Initial Tags
javascript

Initial Language
JavaScript