JS implements transparent PNG images under IE6 and a new method is available!

Source: Internet
Author: User
Tags transparent image

This article focuses on how to use Javascript to implement PNG Image transparency under IE6! Today, I saw a Javascript Implementation Method on Webappers, which is much more effective than what I currently know. For details, see the demonstration page of UnitPNGFix.

A new method to achieve PNG Image transparency under IE6 using Javascript!

There are many ways to implement the PNG Image transparency under IE6. Today we see a method implemented using Javascript on Webappers, which is much more effective than what I know currently, for more information, see the demonstration page of UnitPNGFix.

The implementation principle is very simple. If you use a PNG image as the background in IE6, you can use the IE filter effect. As we all know, I won't say much about it. However, UnitPNGFix can achieve the corresponding effect based on the "repeat" attribute you set. This is amazing! If a PNG image is directly used in the interface, that is, embedded in the interface in the form of "img" title, UnitPNGFix will replace this PNG image with a transparent GIF image, IE6 should support GIF transparency, so you will see a blank and transparent image. As you may have guessed, UnitPNGFix will set the background of the newly generated transparent GIF image to the original PNG Image and perform IE filter on the background image, in this way, the PNG Image transparency under IE6 is achieved.

The UnitPNGFix file is very small, including an uncompressed Javascript file and a transparent GIF image. The total size is only 980 bytes. It's easy to use. You only need to set the address of the transparent GIF image in the Javascript file to use it on your webpage.

UnitPNGFix has the following features:

Small file size, less than 1 kb!

Solved some IE filter attributes;

It can be applied to img objects and background attributes;

Do not need to define classes or functions;

The height and width of the electronic setting element;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.