admin管理员组

文章数量:1421432

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>

本文标签: javascriptIE 10 not respecting zindexStack Overflow