1

jQueryにqtipを使用していますが、次のコードがあります

$('#content a[href]').qtip(
   {
      content: 'Some basic content for the tooltip', // Give it some content, in this case a simple string
       style: { 
      name: 'cream', // Inherit from preset style
      tip: 'topLeft'
      },
      show: {
            when: 'click', // Show it on click...
            solo: true // ...and hide all others when its shown
      },
      hide: {
          when : 'focusout',
          fixed: true
      }
   });

望ましい効果は、リンクをクリックしたときにヒントが表示され、ページの他の部分をクリックしない限りそこにとどまるということです(したがってフォーカスアウト)が、同時にヒント自体をクリックすると、面白いものを挿入できるように消えたくないので、修正されました:true ...しかし、これを行っても、先端をクリックすると消えます...何が間違っているのですか?チップをクリックしたときにチップが消えないようにする別の方法はありますが、ページの別の部分をクリックするとチップが消えますか?

4

1 に答える 1

1

unfocusイベントを使用する必要があります:

$('#content a[href]').qtip({
    content: 'Some basic content for the tooltip',
    // Give it some content, in this case a simple string
    style: {
        name: 'cream',
        // Inherit from preset style
        tip: 'topLeft'
    },
    show: {
        when: 'click',
        // Show it on click...
        solo: true // ...and hide all others when its shown
    },
    hide: {
         when: { event: 'unfocus' }
    }
});

実際のデモ: http://jsfiddle.net/andrewwhitaker/rep87/

ドキュメントから:

「unfocus」イベントは、ツールチップ自体を除く、ドキュメント上の他の場所がクリックされたときにツールチップを非表示にします。


于 2010-12-23T07:21:21.770 に答える