/ Published in: JavaScript
first try to a crossbrowser support for png's opacity support
Expand |
Embed | Plain Text
// 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);
You need to login to post a comment.
