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
      }
   });

想要的效果是当我点击链接时提示应该显示并停留在那里,除非我点击页面的其他部分(因此是焦点输出),但同时如果我点击提示本身,我不会'不希望它消失,这样我就可以在其中插入有趣的东西,因此固定:真......但即使我这样做,当我点击提示时它仍然会消失......我做错了什么或是否有另一种方法可以防止提示在我单击它时消失但如果我单击页面的另一部分它会消失?

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 回答