[英]Jquery pop-up using fancybox
我有一個按鈕,單擊它會顯示一個彈出消息。 代碼如下:
<a id="report_button_id" href="#report_form_container" class="form_show_link" style="text-decoration: none; cursor: hand">
<span id="report_button_text_id" class="top_nav_report_button">My Link Here</span>
</a>
<div style="display:none;">
<div id="report_form_container" class="popup_container">
// Some page is displayed here using div tags
</div>
</div>
在Javascript文件中:
$("a.form_show_link").fancybox({
centerOnScroll:true,
overlayOpacity:0.7,
overlayColor:'#000000',
showCloseButton:false,
hideOnOverlayClick:false,
onStart:resetPopupFormErrors
});
$("#report_form").keypress(function(e) {
if(e.which == 13){
$("#report_form").submit();
}
});
誰能解釋上面的代碼如何在單擊按鈕時顯示彈出窗口,尤其是在沒有樣式時?
謝謝!
如果我理解您的問題(“這是如何工作的?”),這很簡單... Fancybox正在將目標div從其舊容器中移出,並移入它控制的臨時容器中。 因此,其父容器不再對目標產生影響(例如'display:none')。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.