2012-02-14 24 views
1

我正在開發一個工具提示。它必須顯示當我點擊一個href,並且我想通過點擊外部工具提示或延遲後隱藏它。我做了這種方式:如何管理工具提示jquery

$('#aiuti').qtip({ 
     content: { 
      text: "In questa sezione e' possibile pianificare l'invio delle notifiche scegliendo Il Target degli utenti - il Tipo di notifica - Titolo della notifica - Il Messaggio - Periodicita' invio e date - inoltre la periodicita' e gli stati di invio possono essere verificati da apposito pannello con filtri di ricerca." 
     }, 
     show: { 
      event: 'click' 
     }, 
     hide: { 
      delay: 1000 
     } 
    }).click(function() { 
     var _$this = $(this); 

     if(_$this.html() === 'Attiva aiuti') { 

      _$this.html('Chiudi aiuti'); 
     } else { 
      _$this.html('Attiva aiuti'); 
     } 
    }) 

這樣,如果提示將延遲後躲,如果我的鏈接再次點擊,提示再次顯示。我能怎麼做 ?你可以幫我嗎?

+0

中找到解決方案。你有沒有使用任何現有的插件覆蓋這個原因? (就像自學,這是完全可敬的) – 2012-02-14 16:56:40

回答

0

我發現有兩種方式:

第一工具提示的延遲之後隱藏:

$('#aiuti').qtip({ 
    content: { 
      text: "text text text" 
    } 
    ,show: { 
     event: 'click', 
     solo: true // Only show one tooltip at a time 
    } 
    ,hide: { 
     delay: 1000 
    } 
} 

或單擊工具提示後外:

$('#aiuti').qtip({ 
    content: { 
      text: "text text text" 
    } 
    ,show: { 
     event: 'click', 
     solo: true // Only show one tooltip at a time 
    } 
    ,hide: { 
     event:'unfocus' 
    } 
} 

結合使用這兩種方式看起來儘管可以工作,但您可以嘗試在documentation