Skip to content

Instantly share code, notes, and snippets.

@gumayunov
Created February 7, 2009 11:15
Show Gist options
  • Save gumayunov/59853 to your computer and use it in GitHub Desktop.
Save gumayunov/59853 to your computer and use it in GitHub Desktop.
png magic for IE
Element.addMethods({
pngFix: function(el) {
var el = $(el);
if (!(Prototype.Browser.IE && el.match('img') && el.src.include('png'))) return el;
var src = el.src;
var style = {height: el.height, width: el.width}
var filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+src+'",sizingMethod="scale")';
el.src = '/images/pixel.gif';
el.setStyle(style);
el.runtimeStyle.filter = filter;
return el;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment