简体   繁体   English

使用jQuery淡入淡出的IE Explorer中的PNG周围的黑色

[英]Black around PNG in IE Explorer using jquery fade hover

I've searched all day and tried everything to remove the black around my PNGs when I use the Fadein jquery effect in internet explorer. 当我在Internet Explorer中使用Fadein jquery效果时,我整天都在搜索并尝试了所有操作以消除PNG周围的黑色。 I must be missing something because all the code I use doesn't fix it. 我一定会错过一些东西,因为我使用的所有代码都无法修复它。 My page can be visited here: http://www.kaimeramedia.com/derek/Website 我的页面可以在这里访问: http : //www.kaimeramedia.com/derek/网站

I found this bit of code: 我发现了这段代码:

.item img {
    background: transparent;
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)";
/* IE8 */
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
/* IE6 & 7 */
    zoom: 1;
}

but I am unable to get it to work with my menu page ( http://www.kaimeramedia.com/derek/Website/menu.php ) which only looks correct in the index.php template. 但是我无法使其与我的菜单页( http://www.kaimeramedia.com/derek/Website/menu.php )一起使用,该菜单页仅在index.php模板中看起来正确。

The images fade on and off fine in all browsers it just that IE 6+ puts a really thick black border around it. 图像在所有浏览器中都可以很好的淡入淡出,只是IE 6+在其周围放置了一个非常粗的黑色边框。 I know there are many sites that discuss this issue, but I haven't had any luck or at least I must be inputting the code wrong. 我知道有很多网站都在讨论这个问题,但是我没有任何运气,或者至少我输入的代码有误。

I tried editing CSS and the style tags below but it didn't seem to have any effect: 我尝试编辑下面的CSS和样式标签,但似乎没有任何效果:

div.fadehover {
     position: relative;
}

img.b {
     position: absolute;
     left: 0;
     top: 0;

     z-index: 10;
     opacity: 0;
     filter: alpha(opacity=0);
     background: transparent;
}

.style2 {   font-style: italic;     color: #2D6773; }
.style3 {   color: #122833 }

If someone could help me with a working solution to my site that would be really appreciated. 如果有人可以为我的网站提供有效的解决方案,我将不胜感激。

There are many solutions to this problem: 有许多解决此问题的方法:
1) Use a PNG8 instead 1)改用PNG8
2) Use a js script such as Unit PNG Fix 2)使用js脚本,例如Unit PNG Fix
3) Try adding filter: 0 to your image 3)尝试在图片中添加filter: 0
4) Use and ie filtered background emulating rgba(255,255,255,0) 4)使用并过滤背景模拟rgba(255,255,255,0)

background: transparent;
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)"; /* IE8 */   
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);   /* IE6 & 7 */      
zoom: 1;

5) Finally, if no transparency is needed, just use a jpg 5)最后,如果不需要透明度,只需使用jpg

EDIT: This is how one of the images looks in png8, I don't see any major differences... 编辑:这就是其中一张图片在png8中的显示方式,我看不到任何主要区别... 关于PNG8

I've had this exact same problem which is caused by the css filter-property IE requires. 我遇到了完全相同的问题,这是由IE要求的CSS过滤器属性引起的。 In my animation I remove this attribute. 在动画中,我删除了此属性。

$('elem').css('filter', ''); $('elem')。css('filter','');

The old IEs simply cannot perform. 旧的IE根本无法执行。 You can "outhack" many of IEs flaws with javascript only causing these browsers to slow down even more. 您可以使用JavaScript“入侵”许多IE漏洞,仅会使这些浏览器的运行速度进一步降低。

The best solution is graceful degradation and and progressive enhancement (more of that on http://dev.opera.com/articles/view/graceful-degradation-progressive-enhancement/ ). 最好的解决方案是平稳降级和逐步增强(有关更多信息,请参见http://dev.opera.com/articles/view/graceful-degradation-progressive-enhancement/ )。 Don't make IE do things it can't or cannot do well. 不要让IE做无法或不能做的事情。 I know clients have a hard time understanding this but my days of trying to be a magician are over. 我知道客户很难理解这一点,但是我成为魔术师的日子已经结束。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM