0
我使用這個插件:http://www.ericmmartin.com/projects/simplemodal/SimpleModal不關閉的默認按鈕點擊(但在容器的兩側點擊時會關閉)
我試圖使用默認的按鈕關閉彈出窗口,但它將不會關閉。我已經添加了simplemodule-close類來關閉div,但這是無濟於事的。我也嘗試使用jQuery.modal.close();但這是行不通的。
我已閱讀數以百計的其他帖子,但由於某種原因,它不工作。
注:我在WordPress的工作,所以$ = jQuery的(對noConflict)
我的HTML:
<div id="basic-modal-content">
<a class="modalCloseImg simplemodal-close" title="close"></a>
<h1>Login</h1><hr />
</div>
CSS:
#basic-modal-content {
display:none;
background-color:#FFF;
border:4px solid #444;
padding:0 20px;
z-index: 2000;
position: fixed;
left:50%; margin-left:-280px; top:10%;
}
#basic-modal-content hr{display:none;}
#basic-modal-content .loginform form{width:100%;}
#basic-modal-content a.modalCloseImg{right:-13px;top:-10px;}
/* Overlay */
#simplemodal-overlay {background-color:#000;}
/* Container */
#simplemodal-container {height:360px; width:600px; color:#bbb; background-color:#333; border:4px solid #444; 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;}
a.modalCloseImg {background:url(/files/2013/12/x.png) no-repeat; width:25px; height:29px; display:inline; z-index:3200; position:absolute; top:-15px; right:-16px; cursor:pointer;}
#simplemodal-container h3 {color:#84b8d9;}
的Javascript:
jQuery(function (jQuery) {
// Load dialog on click
jQuery('.login_nav .basic').click(function (e) {
jQuery('#basic-modal-content').modal();
return false;
});
jQuery('.modalCloseImg').on('click', function(){
jQuery.modal.close();
})
});
要製作的按鈕在div出現:
echo "<div class=\"login_nav\"><a href=\"/ta-login/?ta-logout=true\">Logout</a></div>"; } else { echo "<div class=\"login_nav\"><a href=\"#\" class=\"basic\">Login</a></div>"; }
} else { echo "<div class=\"login_nav\"><a href=\"#\" class=\"basic\">Login</a></div>"; }
嘗試將該元素設置爲'display:block'而不是'display:inline'。 – brouxhaha