如何禁用 Bootstrap 工具提示

问题描述 投票:0回答:1

如何禁用引导工具提示? 我启用它使用:

function activateTooltip() {
  const toolTips = document.querySelectorAll('.tooltip');

  toolTips.forEach(t => {
    new bootstrap.Tooltip(t);
  });
}

我正在使用 bootstrap .min 文件中的这个函数

javascript twitter-bootstrap bootstrap-5
1个回答
1
投票

您必须保存 Bootstrap 工具提示的引用并调用 .disable() 方法。

// Enable tooltip
const tooltip = new bootstrap.Tooltip(yourElement);

// Disable tooltip
tooltip.disable();

// Enable tooltip again
tooltip.enable();
© www.soinside.com 2019 - 2024. All rights reserved.