简体   繁体   English

使用fancybox的jQuery弹出窗口

[英]Jquery pop-up using fancybox

I've a button clicking on which it shows a pop-up message. 我有一个按钮,单击它会显示一个弹出消息。 Code is given below: 代码如下:

<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>

In Javascript file: 在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();
    }
});

Can any one explain how the above code is displaying pop-up windows on clicking button especially when the style is none???? 谁能解释上面的代码如何在单击按钮时显示弹出窗口,尤其是在没有样式时?

Thanks! 谢谢!

If I understand your question ('how does this work?'), it is prett simple... Fancybox is moving the target div out of its old container and into a temporary one that it controls. 如果我理解您的问题(“这是如何工作的?”),这很简单... Fancybox正在将目标div从其旧容器中移出,并移入它控制的临时容器中。 As such, its parent containers no longer have influence on the target (such as 'display:none'). 因此,其父容器不再对目标产生影响(例如'display:none')。

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

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