IE7 不透明图像叠加问题
我在 IE7 中的图像上设置不透明覆盖 div 时遇到问题。其他所有浏览器(注意:IE6 及更早版本尚未经过测试)都能很好地处理我的代码和标记,但 IE7 却不能。覆盖层不是不透明的,并且不显示底层图像。
这是我的标记。
<li>
<a href="/AquaTrade/designclub/index.php/cs/program/12-program/89-miloslav-cejka">
<div style="background-image: url(http://10.0.0.3/AquaTrade/designclub/images/stories/program-ico/ikona-cejka-a-club.jpg);">
<div class="catImg" style="opacity: 0.6; ">
<!--img src="http://10.0.0.3/AquaTrade/designclub/images/stories/program-ico/ikona-cejka-a-club.jpg" alt="" /-->
</div>
<div class="catTitle"><span>Miloslav Čejka</span></div>
</div>
</a>
</li>
div.catImg 上的不透明度由 jQuery fadeTo 函数设置,因此在 IE 中它是 alpha 不透明度 以下函数设置不透明度
function createCategories() {
jQuery("#categories div.catImg").fadeTo(0,0.6);
jQuery("#categories div.catImg").mouseenter(function() {
jQuery(this).fadeTo(0, 0 );
});
jQuery("#categories div.catImg").mouseout(function() {
jQuery(this).fadeTo(0, 0.6 );
});
makeCategoriesPosition();
}
I'm having trouble setting an opaque overlay div over an image in IE7. Every other browser (note: IE6 and older haven't been tested) handle my code and markup well, but IE7 doesn't. The overlay is not opaque, and the underlying image is not shown.
Here is my markup.
<li>
<a href="/AquaTrade/designclub/index.php/cs/program/12-program/89-miloslav-cejka">
<div style="background-image: url(http://10.0.0.3/AquaTrade/designclub/images/stories/program-ico/ikona-cejka-a-club.jpg);">
<div class="catImg" style="opacity: 0.6; ">
<!--img src="http://10.0.0.3/AquaTrade/designclub/images/stories/program-ico/ikona-cejka-a-club.jpg" alt="" /-->
</div>
<div class="catTitle"><span>Miloslav Čejka</span></div>
</div>
</a>
</li>
The opacity on div.catImg is set by jQuery fadeTo function, so in IE is it alpha-opacity
Following function set the opacity
function createCategories() {
jQuery("#categories div.catImg").fadeTo(0,0.6);
jQuery("#categories div.catImg").mouseenter(function() {
jQuery(this).fadeTo(0, 0 );
});
jQuery("#categories div.catImg").mouseout(function() {
jQuery(this).fadeTo(0, 0.6 );
});
makeCategoriesPosition();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您不能在 IE css 中使用
opacity
。查看本文了解更多信息
You cannot use
opacity
in IE css.see this article for more
这是因为您在链接中嵌套了一个 div。它可能以某种方式不显示为块元素,因为它位于链接标记内。
Its because you are nesting a div within a link. Its probably somehow not displaying as a block element because its inside the link tag.
我用正确的模型为您重新创建了一个示例:
Css 是:
jQuery 是:
Html 是:
I recreated a sample for you with a correct model:
Css is:
jQuery is:
Html is: