Eric Meyer just posted an updateto his s5 script in which he has added support for alpha transparency for IE6. The fix comes thanks to Erik Arvidsson’s pngbehavior.htc. Very cool… sucks to have to hack around IE yet again but what are you going to do?
His one lament about this fix:
Now I don’t pretend to be an “IE/Win JS guru” but decided to play around anyway. Using the simpler example at the top of Erik’s page I saw what the “bare necessities” were. Now that I go back and look at his .htc behavior closer, I see that I am doing some of what he was doing there… but just in the JS.
What I came up with is a quick little JS script that cycles through all the images on the page, if an image is a png (detected by the extension) then it applies the appropriate filter and replaces the image with a clear .gif file. This eliminates the need to have any image specific references in the CSS or JS, and the need for the HTC file altogether.
See a demo of the script in action.
I’d get all fancy and separate out the script and stuff for you to easily peruse, but I probably need to get back to work. So just view source and poke around.
Hopefully it is found useful, and will be a help to Eric’s issue. Thanks to Erik for the initial script and research. Feedback is welcomed as I’m always willing to learn.