我正在研究简单的jquery模态。我想在模态后面的叠加中执行onclick事件。 Here is the link for modal。当用户点击模态外我需要关闭模态。这是代码。
#basic-modal-content {display:none;}
/* Overlay */
#simplemodal-overlay {background-color:#000; cursor:wait;}
/* Container */
#simplemodal-container {height:300px; width:600px; color:#bbb; background-color:#FFF; border:6px solid #72A014;border-radius:12px;-webkit-border-radius:12px;-moz-border-radius:12px; padding:12px;}
#simplemodal-container .simplemodal-data {padding:8px;}
#simplemodal-container code {background:#141414; border-left:3px solid #65B43D; color:#bbb; display:block; font-size:12px; margin-bottom:12px; padding:4px 6px 6px;}
#simplemodal-container a {color:#ddd;}
#simplemodal-container a.modalCloseImg {background:url(close.png) no-repeat; width:40px; height:40px; display:inline; z-index:3200; position:absolute; top:-20px; right:-23px; cursor:pointer;}
#simplemodal-container h3 {color:#84b8d9;}
当用户点击叠加时,需要关闭模态。是否有任何方法可以跟踪模态外的onclick事件并关闭它?
希望我的问题很明确。在此先感谢!!
答案 0 :(得分:1)
将事件绑定到#simplemodal-overlay
$("#simplemodal-overlay").click(function(){
//code to remove the overlay , same as on the close btn
});
但我不明白为什么等待光标叠加。?
答案 1 :(得分:0)
未经测试,但看起来它应该有效:Forums ASP.NET