淡入时 IE 在 PNG 周围显示黑色边框
这是我的网站: http://smartpeopletalkfast.co.uk/ppr6/
我有带有 jQuery 透明度淡入的 PNG。 IE8(尚未与其他人进行测试)在 PNG 淡入时显示周围有黑色边框。我知道这是一个公认的问题,我尝试了一些方法但没有运气。
但是,我注意到心脏(最后加载的图像)没有黑色边框。为什么这个可以呢?希望我能弄清楚为什么我可以用它来修复其他问题。
谢谢
更新,
我玩了很多代码,我没有意识到我无意中禁用了心脏的淡入,所以这就是为什么没有边框。
这是一个奇怪的问题。在我看过的所有论坛中,他们的解决方案似乎对某些人有效,但对其他人无效。
Here is my site:
http://smartpeopletalkfast.co.uk/ppr6/
I have PNGs with transparency fadein with jQuery. IE8 (havnt tested with others yet) is showing black borders around the PNGs while they fade in. I know this is a recognized issue and I've tried a few methods without luck.
However, I've noticed that the heart (the last image to load) doesn't have the black borders. Why is this one OK? Hopefully if I figure out why I can use it to fix the others.
Thanks
UPDATE
I'd played around with code so much I hadn't realized I'd unintentionally disabled the fade in of the heart, so thats why no borders.
It's a weird issue this one. In all the forums I've looked at their are solutions that seem to work for some people but not for others.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我知道这个帖子很老了,无论如何我发现这篇文章对我来说非常有用,它完全消除了 IE7、IE8 中 PNG 的黑色边框。
您可以在此线程中找到它 http://www.sitepoint.com/forums/showthread.php?590295-jQuery-fadein-fadeout-of-transparent-png-in-IE7-and-Chrome
I know this thread is very old, anyways I found this post which worked great for me, it completely removes the black borders from PNG's in IE7, IE8.
You can find it int this thread http://www.sitepoint.com/forums/showthread.php?590295-jQuery-fadein-fadeout-of-transparent-png-in-IE7-and-Chrome
将此属性添加到您的标签中,如下所示
add this attribute to your tag like this
使用 PNG-8 对我有用。它们的图像有一个轻微的白色边框,在实际文件中不是浏览器问题,但在我的情况下,这看起来不错。
Using a PNG-8 worked for me. Their is a slight white border to the image which is in the actual file not a browser issue but in my case this looks fine.
设置背景颜色
put background color
我在使用 jquery 设置元素的不透明度时遇到了同样的问题,如
$('div').css('opactiy',0.5);
我能够通过为相关的“div”设置纯色背景色来修复它。
简单演示:http://jsfiddle.net/mwXs3/3/(在firefox和ie8中进行比较)...
i've had the same issue setting the opacity of an element using jquery as in
$('div').css('opactiy',0.5);
i was able to fix it by setting a solid background color for the 'div' in concern.
simple demonstration: http://jsfiddle.net/mwXs3/3/ (compare this in firefox and ie8)...