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.
2 Answers
Reset to default 6Internet-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
评论列表(0条)