简体   繁体   English

在CSS中跟踪Onclick事件-执行一些操作

[英]Track Onclick event in CSS - perform some action

I am working on simple jquery modal. 我正在研究简单的jQuery模态。 I want to perform onclick event in a overlay behind the modal. 我想在模式后面的叠加层中执行onclick事件。 Here is the link for modal . 这是modal的链接 When user clicks outside the modal i need to close the modal. 当用户在模态之外单击时,我需要关闭模态。 Here is the code. 这是代码。

#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;}

When user clicks on overlay the modal needs to be closed. 用户单击叠加时,需要关闭模式。 Is there any method to track the onclick event outside modal and close it?? 有什么方法可以跟踪模式外部的onclick事件并关闭它吗?

Hope my question is clear. 希望我的问题清楚。 Thanks in Advance!! 提前致谢!!

Bind an event to #simplemodal-overlay 将事件绑定到#simplemodal-overlay

$("#simplemodal-overlay").click(function(){
//code to remove the overlay , same as on the close btn
});

But i didnt understand why that wait cursor on overlay.? 但我不明白为什么在覆盖上等待光标。

未经测试,但看起来应该可以使用: 论坛ASP.NET

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM