2013-10-11 161 views
0

我使用asp.net mvc剃鬚刀代碼。 我使用qtip在鼠標懸停上顯示彈出窗口。 我在設置頁面有一個複選框,用於啓用/禁用qtip。啓用或禁用qtip複選框

這裏是我的代碼:

function tooltip(a) { 
    Sapppid = document.getElementById("s" + a).textContent; 
    Sapppid = Sapppid.replace("s", ""); 
    $.ajax({ 
     url: window.location.pathname + "Scheduler/getappointmentdetails", 
     type: "POST", 
     data: { sharedappid: Sapppid } 
    }) 
    .success(function (result) { 
     document.getElementById('ApptDetails').value = result; 
    }); 

    $("#" + a).qtip({ 
     overwrite: false, 
     content: { 
      text: "...", 
      button: 'Close', 
      ajax: { 
       url: window.location.pathname + "Scheduler/Eventdetails/" + Sapppid, 
       type: 'Post', 
       success: function (result) {} 
      } 
     }, 
     style: { 
      classes: '', 
      width: 500 
     }, 
     position: { 
      my: 'right bottom center', 
      at: 'middle right center', 
      target: $("#" + a) 
     }, 
     show: { 
      ready: true, 
      solo: true 
     }, 
     hide: { 
      when: { event: 'mouseout unfocus' }, fixed: true, delay: 200 
     } 
    }); 
} 

我設計qtip到showup上的動態內容。我使用qtip2。我沒有找到任何文檔在網站中禁用或啓用。

這是我發現的,但不可能找出其中應用此.:

http://qtip2.com/api#api.disable

api.disable(true); 

// Enable it again 
api.disable(false); 
+0

申請按鈕,或者別的東西 –

回答

2

附上一個onclick事件到您的複選框,並在放置禁止的唯一代碼您正在瞄準的元素上的qtip功能

代碼示例:

$('.checkbox').on('click', function(){ 
    $('.dynamic').qtip('disable', true); 
}); 

試試這個,讓我知道,如果它在評論

0

嘗試這樣的事情

$('.checkbox').on('click', function(){ 
     var api = $('.dynamic').qtip('api'); 
     api.disable(true); 
    });