我需要帮助模态对话框在IE浏览器中不起作用这里是我的代码请验证我在哪里做错了建议我。它在Firefox和Chrome中工作但是IE不起作用。请验证我的下面代码和给我一个建议。
HTML code:
<a href='#openModal' ><img src='images/question.png' /> </a>
<div id='openModal' class='modalDialog'>
<div>
<a href='#close' title='Close' class='close'>X</a>
<img src='images/ifsc-code1.png' />
</div>
</div>
CSS code:
.modalDialog {
position: fixed;
font-family: Arial, Helvetica, sans-serif;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0,0,0,0.8);
z-index: -1;
opacity:0;
-webkit-transition: opacity 400ms ease-in;
-moz-transition: opacity 400ms ease-in;
transition: opacity 400ms ease-in;
pointer-events: none;
}
.modalDialog:target {
opacity:1;
pointer-events: auto;
}
.modalDialog > div {
width: 604px;
//height: 600px;
position: relative;
margin: 5% auto;
padding: 5px 20px 13px 20px;
border-radius: 10px;
background: #fff;
background: -moz-linear-gradient(#fff, #999);
background: -webkit-linear-gradient(#fff, #999);
background: -o-linear-gradient(#fff, #999);
-moz-box-shadow: -5px -5px 30px #888888,5px 5px 30px #888888;
-webkit-box-shadow:-5px -5px 30px #888888 ,5px 5px 30px #888888;
box-shadow: -5px -5px 30px #888888,5px 5px 30px #888888;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
}
.close {
background: #606061;
color: #FFFFFF;
line-height: 25px;
position: absolute;
right: -12px;
text-align: center;
top: -10px;
width: 24px;
text-decoration: none;
font-weight: bold;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
border-radius: 12px;
-moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000;
box-shadow: 1px 1px 3px #000;
}
.close:hover { background: #00d9ff; }
答案 0 :(得分:1)
以下代码在IE9,IE10,Firefox和Chrome中非常适合我。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<style>
.modalDialog {
position: fixed;
font-family: Arial, Helvetica, sans-serif;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0,0,0,0.8);
z-index: -1;
opacity:0;
-webkit-transition: opacity 400ms ease-in;
-moz-transition: opacity 400ms ease-in;
transition: opacity 400ms ease-in;
pointer-events: none;
}
.modalDialog:target {
opacity:1;
pointer-events: auto;
}
.modalDialog > div {
width: 604px;
//height: 600px;
position: relative;
margin: 5% auto;
padding: 5px 20px 13px 20px;
border-radius: 10px;
background: #fff;
background: -moz-linear-gradient(#fff, #999);
background: -webkit-linear-gradient(#fff, #999);
background: -o-linear-gradient(#fff, #999);
-moz-box-shadow: -5px -5px 30px #888888,5px 5px 30px #888888;
-webkit-box-shadow:-5px -5px 30px #888888 ,5px 5px 30px #888888;
box-shadow: -5px -5px 30px #888888,5px 5px 30px #888888;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
}
.close {
background: #606061;
color: #FFFFFF;
line-height: 25px;
position: absolute;
right: -12px;
text-align: center;
top: -10px;
width: 24px;
text-decoration: none;
font-weight: bold;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
border-radius: 12px;
-moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000;
box-shadow: 1px 1px 3px #000;
}
.close:hover { background: #00d9ff; }
</style>
</head>
<body>
<a href='#openModal' ><img src='images/question.png' /> </a>
<div id='openModal' class='modalDialog'>
<div>
<a href='#close' title='Close' class='close'>X</a>
<img src='images/ifsc-code1.png' />
</div>
</div>
</body>
</html>
答案 1 :(得分:0)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<style>
.pop-up {position:absolute; top:0; left:-500em}
.pop-up:target {position:static; left:0;}
.popBox {
background:#ffffff;
position:absolute; left:30%; right:30%; top:30%; bottom:30%;
z-index:1;
border:1px solid #3a3a3a;
-moz-border-radius:12px;
border-radius:12px;
-webkit-box-shadow:2px 2px 4px #3a3a3a;
-moz-box-shadow:2px 2px 4px #3a3a3a;
box-shadow:2px 2px 4px #3a3a3a;
opacity:0;
-webkit-transition: opacity 0.5s ease-in-out;
-moz-transition: opacity 0.5s ease-in-out;
-o-transition: opacity 0.5s ease-in-out;
-ms-transition: opacity 0.5s ease-in-out;
transition: opacity 0.5s ease-in-out;
}
:target .popBox {position:fixed; opacity:1;}
.popBox:hover {box-shadow:3px 3px 6px #5a5a5a;}
.lightbox {display:none; text-indent:-200em; background:#000; opacity:0.4; width:100%; height:100%; position:fixed; top:0; left:0; bottom:0; right:0;}
:target .lightbox {display:block}
.close {
position:absolute; top:-0.75em; right:-0.75em; display:block; width:1em; height:1em;
font:bold large/1 arial, sans-serif; text-align:center; text-decoration:none;
background:#000; border:3px solid #fff; color:#fff;
-moz-border-radius: 1em;
-webkit-border-radius: 1em;
border-radius: 1em;
-moz-box-shadow: 0 0 1px 1px #3a3a3a;
-webkit-box-shadow: 0 0 1px 1px #3a3a3a;
box-shadow: 0 0 1px 1px #3a3a3a;
}
.close:before {content:"X"}
.close:hover {box-shadow:0 0 1px 1px #c00; background:#c00;}
.close span {text-indent:-200em; display:block;}
</style>
</head>
<body>
<ul id="links">
<li><a href="#pop3">Pop-up Two</a></li>
</ul>
<div id="pop3" class="pop-up">
<div class="popBox">
<div>
<h2>Pop-up Two</h2>
<p>Blah, blah, blah. Yada, yada, yada.</p>
</div>
<a href="#" class="close"><span>Close</span></span></a>
</div>
</div>
</body>
</html>
以上代码适用于I.E-9
的所有浏览器