【发布时间】:2015-01-13 02:07:24
【问题描述】:
我使用非常简单干净的代码在我的页面中呈现模式:
<div class="modal">I'm the Modal Window!</div>
.modal {
/* some styles to position the modal at the center of the page */
position: fixed;
top: 50%;
left: 50%;
width: 300px;
line-height: 200px;
height: 200px;
margin-left: -150px;
margin-top: -100px;
background-color: #f1c40f;
text-align: center;
/* needed styles for the overlay */
z-index: 10; /* keep on top of other elements on the page */
outline: 9999px solid rgba(0,0,0,0.5);
}
是否有一种干净可靠的方法来检测何时有人在模式之外点击?
【问题讨论】:
-
你需要使用javascript
-
你有没有尝试过?
标签: javascript jquery css