twitter-bootstrap 是否有响应式引导程序弹出窗口替代方案?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22079545/
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
Is there responsive bootstrap popover alternative?
提问by orbitory
Currently bootstrap 2.3.2 popover is not responsive. On small screens it opens outside the screen. Is there an alternative?
目前 bootstrap 2.3.2 popover 没有响应。在小屏幕上,它在屏幕外打开。有替代方案吗?
Thank you
谢谢
回答by orbitory
I use this method in the meanwhile for better popover placement, should work with Bootstrap 2 and 3:
我同时使用这种方法来更好地放置弹出框,应该适用于 Bootstrap 2 和 3:
$("[data-toggle='popover']").popover({
// Add more else stuff with parentheses for more sizes
placement: function() { return $(window).width() < 975 ? 'top' : 'right'; }
});
If you have issues the popover width, first ensure the containerparameter has a proper value, e.g. container: 'body'.
如果您有弹出窗口宽度的问题,请首先确保container参数具有正确的值,例如container: 'body'.
回答by Horacio Alexandre Fernandes
For responsive behavior, Bootstrap 3 has autovalue for placement.
对于响应行为,Bootstrap 3 具有自动值放置。
E.g.
例如
placement: 'auto left'
位置:'自动离开'
When "auto" is specified, it will dynamically reorient the tooltip. For example, if placement is "auto left", the tooltip will display to the left when possible, otherwise it will display right.
当指定“auto”时,它将动态地重新定向工具提示。例如,如果放置为“自动向左”,则工具提示将尽可能显示在左侧,否则将显示在右侧。
回答by Antony
This solution worked for me ..
这个解决方案对我有用..
if ($(window).width() < 800){
$('.prioritypopups').data('placement','right');
} else {
$('.prioritypopups').data('placement','left');
}
$('[data-toggle="popover"]').popover();
However this is technically not responsive but does respond to different page sizes.
然而,这在技术上没有响应,但确实响应不同的页面大小。
回答by Coderapper
There are more improvement in recent development. you should try latest version of bootstrap Currently v3.1.1 .
最近的发展有更多的改进。您应该尝试最新版本的 bootstrap 当前 v3.1.1 。

