qtip2模态对话框没有隐藏

时间:2013-03-22 05:34:32

标签: javascript jquery qtip2

我正在使用qtip2进行提醒,确认,对话功能。现在我想作为(blockui插件)阻止页面的视图,直到某个进程完成(例如ajax start等)。为此,我使用以下代码

function blockPageDialog(content, title) {

    /* 
    * mainbody is the id of the body section of html
    */
    $('#mainbody').qtip(
                {
                    content: {
                        text: '<img src="/Content/images/ajax-loader.gif"/>'

                    },
                    position: {
                        my: 'center', at: 'center', // Center it...
                        target: $(window) // ... in the window
                    },
                    show: {
                        ready: true, // Show it straight away
                        modal: {
                            on: true, // Make it modal (darken the rest of the page)...
                            blur: false, // ... but don't close the tooltip when clicked
                            escape: false //dont hide on escape button 
                        }
                    },
                    hide: true, // We'll hide it maunally

                    style: {
                        classes: 'qtip-shadow qtip-rounded qtip-dialogue', // Optional shadow...
                        widget: true //themeroller
                    },

                    events: {
                        // Hide the tooltip when any buttons in the dialogue are clicked
                        render: function (event, api) {
                            // $('button', api.elements.content).click(api.hide);

                        }
                        // Destroy the tooltip once it's hidden as we no longer need it!
                        , hide: function (event, api) { api.destroy(); }
                    }
                });
}

我在上面调用函数

blockPageDialog(imageToShowProcessing );

按预期阻止页面。

现在我想要隐藏/销毁在完成流程时创建的阻止对话框(例如ajax完成)或按钮点击而不是对话框的一部分(这就是为什么我在对话框中注释了按钮的代码)。

我尝试了以下内容

$('#mainbody').qtip('hide');

$('#mainbody').qtip('api').hide();

两者都不起作用。

我正在使用jquery 1.9.1,qtip2 update(2.1)解决$.browser错误

请指导我解决问题

1 个答案:

答案 0 :(得分:2)

尝试$('#mainbody').qtip('destroy');