小影志 > 怀旧风情 > 前端开发 > Unit PNG Fix & IE PNG Fix - 解决IE6下PNG透明问题

Unit PNG Fix & IE PNG Fix - 解决IE6下PNG透明问题

作者:佚名 来源:小影志 时间:2011-08-10

IE6下的PNG图片的透明是个老问题了,前几天也为此而烦恼,不过现在搜到个十分简单的解决方法,只需要一个的JS文件和一个1*1象素的GIF图片即可。

 解决IE6下PNG透明问题

 

Unit PNG Fix

Waaaaah! Waaaaaah! You hear that? That’s IE6 whining about how you should be using an obtuse “filter” attribute, causing all those nice, pretty pngs on your page to go whacky. Fortunately for you, we got just the thing to shut it up. Give it just the tiniest dose of our Unit PNG Fix and bask in the the glorious phosphoresence of your png images once again! While this is not the only png fix out there (in fact, it was inspired by Drew McLellan’s supersleight), here’s why it will be the last one you need to download:

 

  • Very compact javascript: Under 1kb!
  • Fixes some interactivity problems caused by IE’s filter attribute.
  • Works on img objects and background-image attributes.
  • Runs automatically. You don’t have to define classes or call functions.
  • Allows for auto width and auto height elements.
  • Super simple to deploy.