Turn the Tooltip Bootstrap functionality off

此生再无相见时 提交于 2019-11-30 00:19:51
Jasny - Arnold Daniels

You can't disable tooltips that way because it has no event listener on the body. Instead, you can disable the tooltips themselves using the code below.

$('[rel=tooltip]').tooltip()          // Init tooltips
$('[rel=tooltip]').tooltip('disable') // Disable tooltips
$('[rel=tooltip]').tooltip('enable')  // (Re-)enable tooltips
$('[rel=tooltip]').tooltip('destroy') // Hide and destroy tooltips
Caio Tarifa

Can you try:

$('a[rel=tooltip]').tooltip();
$('a[rel=tooltip]').off('.tooltip');

Don't forget to change the selector. Works fine for me... http://jsfiddle.net/D9JTZ/

To permanently disable a tooltip:

$('[data-toggle="tooltip"]').tooltip("disable");

To stop the tooltip from being displayed on hover but have the ability to re-enable it:

$('[data-toggle="tooltip"]').tooltip("destroy");

$('[data-toggle="tooltip"]').tooltip(); // re-enabling

I found a way to do it using CSS! Just add .tooltip { visibility: hidden } to your CSS file.

If you want to make your link accessibility friendly without the tooltip, then just add aria-label= "Here's a link description."

Hope this helps!

I struggled too with this, but I came up with a solution! In my case I use Jquery Sortable which is ofcourse annoying when you have tooltips flying around!

So I made a variable

var sort = '0`;

And since almost every tooltip has an init() function, I created

if(window.sort!='1') { // So I'm not sorting
  init.tooltip();
}

So, this can be the easiest enable/disable function!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!