bootstrap 弹出窗口在 IE11 中不工作
bootstrap popover not working in IE11
试图在 svg 上显示 bootstrap 弹出窗口。设法让它在 Safari 和 Firefox 中工作(尚未测试 Chrome)但无法让它在 IE 中工作 - 试过 IE11。
弹出窗口的关键在于它是在单击 svg 时启动的,然后通过单击弹出窗口标题中的 x 或屏幕上的任何其他位置将其关闭。
我已经设置了一个 jsfiddle 来显示我正在努力实现的目标。 IT 只是在 IE11 中不起作用。
<a id="testPopover" tabindex="0" class="popover_wrapper" data-toggle="popover" data-trigger="focus" data-container="body">
<svg width="310" height="110">
<rect width="300" height="100" style="fill:rgb(0,0,255);stroke-width:3;stroke:rgb(0,0,0)" />
</svg>
</a>
似乎使用 bootstrap v4 可能会解决这个问题。正在进行进一步测试
我会将触发器更改为 click
,然后我会做 data-dismiss="#testPopover"
而不是 data-dismiss="popover"
(什么都不做),这样您就可以参考有弹出窗口的元素,那么你可以这样做:
$("body").on("click", ".popover .close", function(e) {
e.preventDefault();
$($(this).data('dismiss')).popover('hide');
})
试图在 svg 上显示 bootstrap 弹出窗口。设法让它在 Safari 和 Firefox 中工作(尚未测试 Chrome)但无法让它在 IE 中工作 - 试过 IE11。
弹出窗口的关键在于它是在单击 svg 时启动的,然后通过单击弹出窗口标题中的 x 或屏幕上的任何其他位置将其关闭。
我已经设置了一个 jsfiddle 来显示我正在努力实现的目标。 IT 只是在 IE11 中不起作用。
<a id="testPopover" tabindex="0" class="popover_wrapper" data-toggle="popover" data-trigger="focus" data-container="body">
<svg width="310" height="110">
<rect width="300" height="100" style="fill:rgb(0,0,255);stroke-width:3;stroke:rgb(0,0,0)" />
</svg>
</a>
似乎使用 bootstrap v4 可能会解决这个问题。正在进行进一步测试
我会将触发器更改为 click
,然后我会做 data-dismiss="#testPopover"
而不是 data-dismiss="popover"
(什么都不做),这样您就可以参考有弹出窗口的元素,那么你可以这样做:
$("body").on("click", ".popover .close", function(e) {
e.preventDefault();
$($(this).data('dismiss')).popover('hide');
})