在IE8中,一个空div层的z-index问题 [英] problem with z-index of an empty div layer in IE8

查看:135
本文介绍了在IE8中,一个空div层的z-index问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IE8中遇到z-index的问题(其他IS还没有测试过):

以下JS创建了一些html / css:

  document.write('< img id =''+ sas_Banderole.getObjId('cb')+''src =''+ cburl + ''style =position:absolute; top:5px; cursor:pointer;onclick =sas_Banderole.trigger();border = 0>'); 
document.write('< div ID =closeReminderstyle =z-index:10000; background-color:transparent; text-align:right; display:none; width:30px; height:100px; right:0px; position:absolute; top:5px; cursor:pointer; color:fff; font-size:10px;onclick =reminder_close();border = 0>& nbsp;< / div>) ;


document.write('< / div>');

结果应该是,我有:


  • 带有
    关闭功能的IMG标签(关闭按钮)。

  • 一个DIV标签,其中
    创建一个div层CloseReminder
    ,一个高z值的索引和一个onClick
    事件用于关闭父层



DIV必须位于IMG前面,并应符合css。



在FF,CHrome,Opera等中它正在工作,但在IE8中图层正在放置在图像的后面。我不明白,为什么... ...

我发现,如果我给这个图层一个背景色(fe blue),div就在前面不幸的是,如果我给它的背景色是透明的(它必须是不可见的)。

有人有线索吗?
感谢您的帮助,



Best,
Dirk

解决方案

解决方法:

尝试添加 background:black; filter:alpha(opacity = 0); #closeReminder div。不是很好,但至少它可以工作......

我想有一些更好的解决方案,但我不记得它(所以它可能只是一个醉酒的梦想)。


I have a problem with z-index in IE8 (other IS not tested yet):

The following JS creates some html/css:

document.write('<img id="' + sas_Banderole.getObjId('cb') + '" src="' + cburl + '" style="position:absolute; top:5px; cursor:pointer;" onclick="sas_Banderole.trigger();" border=0>');
document.write('<div ID="closeReminder" style="z-index:10000; background-color:transparent; text-align: right; display:none; width:30px; height:100px; right: 0px; position:absolute; top:5px; cursor:pointer; color:fff; font-size:10px;" onclick="reminder_close();" border=0>&nbsp;</div>');


document.write('</div>');

Result should be, that I have:

  • an IMG tag (close button) with a closing function.
  • a DIV tag, which creates an div layer "CloseReminder" with an high z-index and an onClick event for closing an parent layer

The DIV must be in front of the IMG and should accoring to the css.

In FF, CHrome, Opera etc. it is working but in IE8 the layer is laying BEHIND the image. I can´t understand, why...

I found out, that if I give the layer a background-color (f.e. blue), the div is laying in front of the image, unfortunetaly not, if I give it the background-color "transparent" (it has to be unvisible)

Has someone a clue? Thanks for helping me,

Best, Dirk

解决方案

A workaround:

Try adding background: black; filter: alpha(opacity=0); to the #closeReminder div. Not nice, but at least it works...

I guess there was some nicer solution, but I can't remember it (so it might just be a drunken dream).

这篇关于在IE8中,一个空div层的z-index问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆