javascript - IE 10 not respecting z-index - Stack Overflow

I have a div with fixed size and position relative on my page. (I unfortunately am not allowed to share

I have a div with fixed size and position relative on my page. (I unfortunately am not allowed to share this code so bear with me if you can). I wanted to to have a disabled input bee re-enabled when double clicked but as you may know disabled inputs don't like to fire click events. I came up with a solution which involves putting an input absolutely positioned inside of the relatively positioned container along with an absolutely positioned div with the same dimensions and position. When double clicking I change the div's display to none. This works beautifully in other browsers but IE 10 (I haven't checked lower versions) doesn't respect the z-indexes that I have placed on the div and input. The div has a z-index of 2 and the input has a z-index of 1 but IE ignores this and allows me to click "through" the div and into the input as if the div weren't there. I'm not asking for anyone to debug my code as I can't show it but I would appreciate any known workarounds for this if it's a mon problem/bug.

I have a div with fixed size and position relative on my page. (I unfortunately am not allowed to share this code so bear with me if you can). I wanted to to have a disabled input bee re-enabled when double clicked but as you may know disabled inputs don't like to fire click events. I came up with a solution which involves putting an input absolutely positioned inside of the relatively positioned container along with an absolutely positioned div with the same dimensions and position. When double clicking I change the div's display to none. This works beautifully in other browsers but IE 10 (I haven't checked lower versions) doesn't respect the z-indexes that I have placed on the div and input. The div has a z-index of 2 and the input has a z-index of 1 but IE ignores this and allows me to click "through" the div and into the input as if the div weren't there. I'm not asking for anyone to debug my code as I can't show it but I would appreciate any known workarounds for this if it's a mon problem/bug.

Share Improve this question asked Apr 28, 2014 at 15:08 Craig LaffertyCraig Lafferty 8013 gold badges11 silver badges31 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

Internet-Explorer is very tricky particularly with z-index and positions.

Okay, whats the Solution? Hard work. Be sure that elements are mostly have an position. Must in some places work with position: relative;.

To address the problem with the z-index, you must go from the highest parent (<html>) up to all childs and set each child a z-index (started with 0), increase each z-index, example:

html {
    z-index:    0;
}

body {
    z-index:    1;
}

header {
    z-index:    2;
}

header nav {
    z-index:    3;
}

Generally, check the validity: HTML Validator, CSS Validator

Add this:

 <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 

And make sure your doctype is set

<!doctype html>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745353599a4623986.html

相关推荐

  • javascript - IE 10 not respecting z-index - Stack Overflow

    I have a div with fixed size and position relative on my page. (I unfortunately am not allowed to share

    2小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信