2013-03-22 116 views
1

我正在使用qtip2提醒,確認,對話功能。現在我想作爲(blockui插件)阻止頁面的視圖,直到某個過程完成(例如ajax start等)。對於我使用下面的代碼qtip2模式對話框不隱藏

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,它解決了$.browser錯誤

qtip2更新(2.1)請指引我解決問題

回答

2

嘗試$('#mainbody').qtip('destroy');

+0

謝謝!!!!!它只是工作!修改爲$('#mainbody')。qtip('destroy');雖然.. – amol 2013-03-22 06:38:00

+0

更正您的建議:) – NoodleFolk 2013-03-22 06:40:24