互联网浏览器:半透明图像
我有下面两张图片。
它们是同一张图像,其中一张对文本有轻微的发光效果。
它们的设置如下:
原始图像作为 div 的背景,“发光”图像作为锚标记的背景,使用
display:block;宽度:100%; height: 100%;opacity: 0;
我正在使用下面的 jquery 代码
$('#header a').hover(
function() {$(this).animate({"opacity":"1"}, 1000);},
function() {$(this).animate({"opacity":"0"}, 1000);});
在悬停时淡入淡出锚点图像。
这在 Firefox、Chrome 等中运行良好。 但在 Internet Explorer 中,图像被赋予透明的纯黑色背景。
我该如何解决这个问题?
注意:我只担心 ie7/8 而不是 6。
http://webspirited.com/header-reachsniper .png http://webspirited.com/header-reachsniper-hover.png
Update
I have decided that this is simply not worth my time to do in internet explorer.
然而,这在 ie9 中工作得很好,所以我想我会在 ie9 以外的浏览器中消除这种效果。
I have the two images below.
They are the same image, with one having a slight glow effect on the text.
They are setup as below:
<div id="header"><a></a></div>
withe the original image being the background for the div, and the 'glow' image being the background for the anchor tag, with display:block; width: 100%; height: 100%;opacity: 0;
i am the using the below jquery code
$('#header a').hover(
function() {$(this).animate({"opacity":"1"}, 1000);},
function() {$(this).animate({"opacity":"0"}, 1000);});
to fade the anchor image in and out on hover.
this works fine in firefox, chrome ect.
But in internet explorer the image is given a solid black background where there is transparency.
How can i fix this?
NB: I am only worried about ie7/8 not 6.
http://webspirited.com/header-reachsniper.png
http://webspirited.com/header-reachsniper-hover.png
Update
I have decided that this is simply not worth my time to do in internet explorer.
However this works perfectly in ie9, so i guess ill remove this effect for browsers less that ie9.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为了设置透明 PNG 图像的不透明度,您需要使用
AlphaImageLoader
过滤器,甚至在 IE8 中也是如此。编辑:您还需要在CSS中添加
alpha
过滤器,如下所示:否则,jQUery将在添加
alpha
时清除现有过滤器> 过滤。In order to set the opacity of a transparent PNG image, you need to use the
AlphaImageLoader
filter, even in IE8.EDIT: You also need to add the
alpha
filter in the CSS, like this:Otherwise, jQUery will clear the existing filter as it adds the
alpha
filter.Dave Shea 的 mezzoblue.com 的这篇文章可能会对您有所帮助:http://mezzoblue.com/archives/2010/05/20/ie8_still_fa/
它记录了他尝试过的所有方法,并且他最后得出的最终解决方案:
最后有一个小小的警告
This post from Dave Shea's mezzoblue.com may help you: http://mezzoblue.com/archives/2010/05/20/ie8_still_fa/
It notes all of the methods which he tried, and the final solution he arrived at the end:
With a tiny caveat at the end