twitter-bootstrap Bootstrap Popover 的位置不正确
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17959217/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Bootstrap Popovers are not positioned correctly
提问by Sneaksta
I have been implementing some extra placements for bootstrap's popovers, and they are all working quite nicely. I am however having trouble with dynamic content in popovers.
我一直在为引导程序的弹出窗口实施一些额外的展示位置,它们都运行良好。然而,我在弹出窗口中遇到动态内容的问题。
The content is rendering fine and dandy, but if I use top positioning for the popover, and it's height changes (dynamically) according to it's content, the placement becomes wrong:
内容呈现得很好,但如果我对弹出框使用顶部定位,并且它的高度根据它的内容(动态)变化,则位置会出错:


How can I fix the popovers so that when the height is adjusted, the anchor point stays the same?
如何修复弹出框,以便在调整高度时,锚点保持不变?
回答by ?s??? ????
Try this:
试试这个:
.popover{position:fixed;}
回答by user2618352
It has the top position by default please make it bottom and adjust the position according to it. Then the height will increase upward and it will not affect your design.
默认为顶部位置,请将其置于底部并根据它调整位置。然后高度会向上增加,不会影响您的设计。
回答by Danield
You'll want something like this:
你会想要这样的东西:
.bubble
{
position: absolute;
left: -100px; /* -half width of bubble + half width of button */
bottom: 100%;
margin-bottom: 15px; /* height of callout spike */
width: 250px;
min-height: 50px;
padding: 5px;
}
From the image in the question it seems that the rule
从问题中的图像看来,规则
margin-bottom: 15px; /* height of callout spike */
is the one that is missing.
是缺少的那个。

