让引导弹出框保持打开状态,直到光标移开它

Get the Bootstrap popover to stay open until cursor is moved away from it?

本文关键字:状态 光标      更新时间:2023-09-26

我有这个实现,使用户能够将鼠标悬停在具有icon-ban-circle类的元素上,然后看到带有链接的引导弹出窗口:

## some_file.html.haml
%i.icon-ban-circle{:rel => 'popover', "data-content" => "<a href="http://www.google.com">Click here</a>".html_safe}
## some_file.js
var showError;
showError = $(".icon-ban-circle").popover({
  html: true,
  trigger: 'hover'
});

但是一旦用户将光标移动到弹出框,它就会消失。如何将弹出框包含在 icon-ban-circle 类中,以便在用户尝试单击弹出框中的链接时保持打开状态?

使用delay

延迟显示和隐藏弹出框 (MS) - 不适用于手动 触发器类型

如果提供了数字,则会对隐藏/显示应用延迟

对象结构为:延迟:{显示:500,隐藏:100

}

与 http://getbootstrap.com/javascript/#popovers 相比