简体   繁体   English

Bootstrap popover在中间对齐

[英]Bootstrap popover align in middle

I am making an interactive svg map with highlights. 我正在制作一个带有亮点的交互式svg地图。 Now I am using the bootstrap popover but it is aligned above the svg. 现在我使用bootstrap popover,但它在svg上方对齐。 What I want is to place it direct over the svg in the middle or something. 我想要的是将它直接放在中间的svg上。

Here is an FIDDLE to see how its build up. 这是一个FIDDLE ,看看它是如何构建的。

As you can see in the Fiddle i trigger the popover on the svg element. 正如您在小提琴中看到的那样,我在svg元素上触发弹出窗口。

How do I acces this specific popover? 如何访问此特定弹出框? I was thinking like this: 我这样想:

$('svg').click(function(){
    $('div').find('.popover').css('top', '100px','!important');
})

But than it is setting top to 100px when you click the second time (when its closing) 但是当你第二次点击时(当它关闭时)将顶部设置为100px

i all ready found the solution wrap the svg in a div and give it an position: relative and display: inline-block than give the popover class: 我已经准备好找到解决方案将svg包装在div中并给它一个position: relativedisplay: inline-block不是给popover class:

.popover {
        .pos-t-l(50%, 50%) !important; (mixin position top-left)
        .translate(-50%; -50%);
    }`

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM