Home > Web Front-end > JS Tutorial > body text

解决IE6的PNG透明JS插件使用介绍_javascript技巧

WBOY
Release: 2016-05-16 17:36:28
Original
1198 people have browsed it

IE6的PNG透明是个老问题了,最近有朋友问我有没有最好的解决这个问题的插件。虽然知道且在用DD_belatedPNG这个插件,今天抽空把这个发上来。

虽然之前在博客里发过一款jquery的png插件,但是不支持背景平铺。
DD_belatedPNG使用了微软的VML语言对PNG图片进行重新绘制,以达到半透明的效果,并且能支持background-position和background-repeat属性,支持伪类。是一款不错的值得推荐的插件,用法也比较简单。

使用方法:

复制代码 代码如下:



引用函数是DD_belatedPNG.fix(),括号里的 .png_bg 改成你的css选择器名称。
ID选择器例子:
复制代码 代码如下:

DD_belatedPNG.fix('#png');

伪类例子:
复制代码 代码如下:

DD_belatedPNG.fix('.png a:hover,.png a:focus');

img标签例子:
复制代码 代码如下:

DD_belatedPNG.fix('img');

如果是多个直接加逗号(英文下的)就行。例如:
复制代码 代码如下:

DD_belatedPNG.fix('.png_bg,#png,.png a:hover,.png a:focus,img');

使用方法:
复制代码 代码如下:



括号里的是样式选择器,中间用逗号隔开
JS文件下载地址:
0.0.8a-min.js (压缩版)

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!