如何关闭从按钮点击一个jQuery的fancybox按钮、jQuery、fancybox

2023-09-11 00:49:11 作者:似你眼中星辰

我使用看中箱创建一个弹出窗口并使用iframe加载其他页面就可以了。这里是我的code

 <脚本类型=文/ JavaScript的>
$(文件)。就绪(函数(){

    $('。历·天)。点击(函数(){
        day_num = $(本).find('day_num。')的HTML()。
        day_data =提示(输入的东西',$(本).find('的内容。)HTML());
        如果(day_data!= NULL){

            $阿贾克斯({
                网址:window.location的,
                键入:POST,
                数据: {
                    天:day_num,
                    数据:day_data
                },
                成功:函数(MSG){
                    location.reload();
                }
            });
            }
        });
    });
$(文件)。就绪(函数(){
    $(a.iframeFancybox1)。的fancybox({
    宽:800,
    高度:650,
    overlayOpacity':'0.4',
    overlayColor':'#000',
    hideOnContentClick:假的,
    自动缩放:假的,
    transitionIn':'弹性',
    transitionOut':'弹性',
    类型:IFRAME
    });
});

< / SCRIPT>
 

它成功地加载页面并执行的东西。但是,而不是关闭弹出窗口形式,它加载弹出自身内部弹出的源代码。我想关闭弹出窗体,当工作完成并返回到从中生成弹出主菜单页面。我如何实现这一目标上的弹出形式按一下按钮。

问候,Rangana

解决方案

呼叫 $ fancybox.close();

也期待这个答案在post

根据 http://fancybox.net/faq

     如何关闭的fancybox从其他元素? ?         

只需拨打 $。fn.fancybox.close()上   您onClick事件

所以,你就应该能够在添加 FN

I'm using fancy box to create a popup and load another page on it using an iframe. here is my code

    <script type="text/javascript">
$(document).ready(function() {

    $('.calendar .day').click(function() {
        day_num = $(this).find('.day_num').html();
        day_data = prompt('Enter Stuff', $(this).find('.content').html());
        if (day_data != null) {

            $.ajax({
                url: window.location,
                type: 'POST',
                data: {
                    day: day_num,
                    data: day_data
                },
                success: function(msg) {
                    location.reload();
                }                       
            });
            }
        });
    });
$(document).ready(function(){
    $("a.iframeFancybox1").fancybox({
    'width'           : 800,
    'height'              : 650,
    'overlayOpacity'     :  '0.4',
    'overlayColor'       :  '#000',
    'hideOnContentClick' :   false,
    'autoScale'          :   false,
    'transitionIn'       :   'elastic',
    'transitionOut'  :   'elastic',
    'type'           :   'iframe'
    });
});

</script>
jQuery Fancybox引用一个样式后 便新窗口打开

It loads the page successfully and does the stuff. But instead of closing the popup form, it loads the popup source form inside the popup itself. I want to close the popup form when the work is done and return to the main menu page from which the popup was generated. How do I achieve this on a button click of the popup form.

Regards, Rangana

解决方案

call to $.fancybox.close();

also look on this answers in the post

According to http://fancybox.net/faq

How can I close FancyBox from other element? ?

Just call $.fn.fancybox.close() on your onClick event

So you should just be able to add in the fn.