我正在使用模式窗口调用登录(它在 Worpress 中,但登录另一个服务)。我正在尝试添加一个按钮来关闭模式窗口 - 看起来它应该可以工作,但它不是......任何想法?
这是我正在使用的js:
<script type="text/javascript">
function overlay() {
el = document.getElementById("overlay");
el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible";
}
$(function(){// document.ready shorthand
$('.close-btn').click(function() {
$('#overlay,.login-popup').fadeOut('3000',function(){//use 3000 in place of 300m
$('#overlay').remove();
});
return false;
});
});
</script>
关闭按钮的 html:
<a class="close-btn" href="#">Close</a>
和CSS:
#overlay {
visibility: hidden;
position: absolute;
left: 0px;
top: 0px;
width:100%;
height:100%;
text-align:center;
z-index: 1000;
background-image:url(../background_trans.png);
background-repeat:repeat;
}
#overlay_content {
width:275px;
width:19.64285714rem;
margin: 100px auto;
background-color: #ebf1e3;
border:1px solid #ccc;
padding:25px;
text-align:left;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
line-height:175%;
}