2014-03-06 38 views
0

已更新問題::它的工作是從左鍵單擊節點,從右鍵單擊它也應該爲我們工作..在右鍵單擊 - >屬性,彈出shpuld顯示在實際節點不在右鍵單擊菜單..如下圖所示..當我點擊做右鍵點擊節點,我會得到右鍵菜單!當我點擊查看屬性彈出應顯示在nodenot右鍵菜單爲什麼qtip工具提示沒有顯示在第一次點擊時彈出,從第二次點擊它顯示工具提示

enter image description here

我有一個佈局10-15個節點,所有節點都將是動態的,在每個節點Ajax調用的點擊需要進行並且ajax結果的結果需要使用qtip工具顯示tip.below是它的代碼。第一次點擊它不顯示彈出,但從seconf點擊其顯示工具tip.why它沒有顯示彈出的第一次點擊?????

var str = "#JP"+ nodeId; 

    $(str).qtip({ 

     content: { 
      text: 'Loading...', 
      ajax: { 
       url: 'url', 
       dataType : 'text', 
       type: 'GET', // POST or GET 
       data: {}, // Data to pass along with your request 
       success: function(data, status) { 
        alert(data); 
        this.set('content.text', data); 
       },error : function(msg, url, line){ 
        alert('msg'+ msg); 
       } 
      } 
      } 
     }); 

回答

1

嘗試使用qTip2(http://qtip2.com),並檢查該演示:

http://jsfiddle.net/craga89/L6yq3/

$('a').each(function() { 
    $(this).qtip({ 
     content: { 
      text: function(event, api) { 
       $.ajax({ 
        url: api.elements.target.attr('href') // Use href attribute as URL 
       }) 
       .then(function(content) { 
        // Set the tooltip content upon successful retrieval 
        api.set('content.text', content); 
       }, function(xhr, status, error) { 
        // Upon failure... set the tooltip content to error 
        api.set('content.text', status + ': ' + error); 
       }); 

       return 'Loading...'; // Set some initial text 
      } 
     }, 
     position: { 
      viewport: $(window) 
     }, 
     style: 'qtip-wiki' 
    }); 
}); 
+0

喜rafaelcastrocouto它的工作...我還有一個問題,它需要從右鍵觸發正如我更新的問題所示..流行應該來節點..我嘗試從側面,但它沒有工作..你可以幫我在這 – javalearner

+0

我不明白它...是一個工具提示...它被觸發懸停......當你點擊右鍵時會發生什麼? – rafaelcastrocouto

相關問題