单击div时Bootstrap popover保持不变

问题描述

当悬停图像时,我正在使用bootstrap 4 popover。 但是,当您单击图像内部的缩放功能时,图像会放大较大,但弹出窗口不会关闭,而是不会再关闭

这里是发生错误的网站; https://www.vanderdrift.bvdodev.nl/nl/creeer-jouw-eigen-tafel

将鼠标悬停在图像上方以查看弹出窗口,然后单击“缩放”功能以查看错误

我尝试使用以下脚本对其进行修复:

$(document).ready(function(){
    $('.configurator-zoom').click(function () {
      $('[data-toggle="popover"]').popover({ trigger: "hover focus" });
    });
});

但是弹出窗口仍然没有关闭。 有人可以看看吗?

谢谢!

解决方法

尝试使用以下脚本修复它:toggleEnabled 这样可以切换弹出窗口。

$(document).ready(function(){
    $('.configurator-zoom').click(function () {
      $('[data-toggle="popover"]').popover({ trigger: "hover,focus" });
      $('[data-toggle="popover"]').popover('toggleEnabled');
    });
});

更多信息:https://getbootstrap.com/docs/4.1/components/popovers/