如何使引导工具提示保持可见,直到单击链接

问题描述:

我有一个链接,我将用作通知,当用户有一些新通知我将通过显示工具提示(twitter bootstrap工具提示)通知用户。我想要实现的是,工具提示应该保持可见,直到用户点击链接。一旦用户点击链接,工具提示就应该销毁。
这就是我现在所拥有的, http://jsfiddle.net/testtracker/QsYPv/

I have a link which I am going to use as notification, when a user has some new notification I am going to notify the user by showing a tooltip(twitter bootstrap tooltip). What I want to achieve is, that tooltip should remain visible till the user clicks the link. once the user clicks link, the tooltip should destroy. this is what i have till now, http://jsfiddle.net/testtracker/QsYPv/

HTML

<p><a href="#" rel="tooltip" data-original-title="you have 2 notifications">Notification</a>.</p>​

JavaScript

JavaScript

$('p a').tooltip({placement: 'bottom'}).tooltip('show');​

发生了什么,工具提示保持可见,直到您将其悬停,并在您将其悬停时采用默认行为(在悬停时显示)。

whats happening there is, tooltip stays visible till you hover it, and takes its default behavior(show on hover) once you hover it.

我希望我已经提供了正确的信息,并清除了我想要做的事情。

I hope I have given proper info, and cleared what I want to do.

这是解决方案 http://jsfiddle.net/testtracker/QsYPv/8/

添加选项触发器

$('p a').tooltip({placement: 'bottom',trigger: 'manual'}).tooltip('show');

然后,使用此行

$('p a').on('click',function(){$(this).tooltip('destroy');});

点击时销毁工具提示。