如何使引导工具提示保持可见,直到单击链接 [英] How to make bootstrap tooltip to remain visible till the link is clicked

查看:59
本文介绍了如何使引导工具提示保持可见,直到单击链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个链接,我将用作通知,当用户有一些新通知我将通过显示工具提示(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');});

点击时销毁工具提示。

这篇关于如何使引导工具提示保持可见,直到单击链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆