我有这个模态窗口
https://jsfiddle.net/wxorg152/
(看起来很糟糕,因为我从网站和CSS代码中复制了,因为没有)
窗口打开问题不会关闭...我该怎么关闭它?
代码HTML:
<div class="border"><a id="gigi" href="#modal">Tabel Dimensiuni</a></div>
<div class="md-modal" id="modal">
<div class="md-content">
<h3>Modal Dialog</h3>
<div>
<a class="md-close" href="#">Close me!</a>
<p class="titlu-modal">Dimensiuni pentru lenjerie</p>
<img src="http://www.altradona.ro/media/wysiwyg/DIMENSIUNI-PENTRU-LENJERIE.png" >
<p class="titlu-modal">Dimensiuni pentru dresuri</p>
<img src="http://www.altradona.ro/media/wysiwyg/DIMENSIUNI-PENTRU-DRESURI.png" >
</div>
</div>
</div>
<div class="md-overlay"></div>
CODE CSS:
#overlay {
visibility: hidden;
position: absolute;
left: 0px;
top: 0px;
width:100%;
height:100%;
text-align:center;
z-index: 1000;
}
#overlay div {
width:300px;
margin: 100px auto;
background-color: #fff;
border:1px solid #000;
padding:15px;
text-align:center;
}
.border{border-bottom:1px solid rgba(227,227,227,0.61);}
#gigi {
color: #000;
text-align: center;
width: 200px;
height: 50px;
line-height: 50px;
text-decoration: none;
border-radius: 2px;
}
gigi:hover {
background-color: #a5281b;
}
.md-modal {
position: fixed;
top: 55%;
left: 50%;
width: 50%;
max-width: 630px;
min-width: 320px;
height: auto;
z-index: 1000;
visibility: hidden;
transform: translateX(-50%) translateY(-50%);
}
.md-modal:target {
visibility: visible;
}
.md-overlay {
position: fixed;
width: 100%;
height: 100%;
visibility: hidden;
top: 0;
left: 0;
z-index: 1000;
opacity: 0;
background: transparent;
transition: all 0.3s;
}
.md-modal:target ~ .md-overlay {
opacity: 1;
visibility: visible;
}
/* Content styles */
.md-content {
color: #fff;
background: url(http://www.altradona.ro/media/wysiwyg/BODY.png) ;
position: relative;
border-radius: 3px;
margin: 0 auto;
}
.md-content h3 {
display:none;
margin: 0;
padding: 0.4em;
text-align: center;
font-size: 2.4em;
font-weight: 300;
opacity: 0.8;
background: rgba(0,0,0,0.1);
border-radius: 3px 3px 0 0;
}
.md-content > div {
padding: 15px 40px 30px;
margin: 0;
font-weight: 300;
font-size: 1.15em;
}
.md-content > div p {
margin: 0;
padding: 10px 0;
}
.md-content > div ul {
margin: 0;
padding: 0 0 30px 20px;
}
.md-content > div ul li {
padding: 5px 0;
}
.md-content a {
display: block;
margin: 0 auto;
font-size: 0.8em;
float:right;
}
/* Effect */
.md-modal .md-content {
-webkit-transform: scale(0.7);
-moz-transform: scale(0.7);
-ms-transform: scale(0.7);
transform: scale(0.7);
opacity: 0;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
transition: all 0.3s;
}
.titlu-modal img
{
width:50px;
}
.md-modal:target .md-content {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
opacity: 1;
}
我把图像更好地理解我想做什么
http://i60.tinypic.com/nbcghg.jpg
我想关闭窗口,但遗憾的是无法工作......你可以帮我解决这个问题吗?
提前致谢!
答案 0 :(得分:2)
对话框未关闭,因为您在所有内容上都有一个叠加div(类md-overlay
)。基本上,点击甚至无法达到“关闭”状态。按钮。
HTML
<div class="border"><a id="gigi" href="#modal">Tabel Dimensiuni</a></div>
<div class="md-modal" id="modal">
<div class="md-content">
<h3>Modal Dialog</h3>
<div>
<a class="md-close" href="#">Close me!</a>
<p class="titlu-modal">Dimensiuni pentru lenjerie</p>
<img src="http://www.altradona.ro/media/wysiwyg/DIMENSIUNI-PENTRU-LENJERIE.png" >
<p class="titlu-modal">Dimensiuni pentru dresuri</p>
<img src="http://www.altradona.ro/media/wysiwyg/DIMENSIUNI-PENTRU-DRESURI.png" >
</div>
</div>
</div>
<!-- **************************************** -->
<div class="md-overlay"></div>
<!-- **************************************** -->
CSS
.md-overlay {
position: fixed;
width: 100%;
height: 100%;
visibility: hidden;
top: 0;
left: 0;
z-index: 1000;
opacity: 0;
background: transparent;
transition: all 0.3s;
}