twitter-bootstrap 如何自动调整弹出框的大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14496514/
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
How to Autoresize popover
提问by zevy_boy
Here is my fiddle. http://jsfiddle.net/sNrLQ/1/
这是我的小提琴。 http://jsfiddle.net/sNrLQ/1/
I want the pop-over to autoresize based on its content. Also I am trying to give it a max width of 400px.
我希望弹出窗口根据其内容自动调整大小。另外我试图给它一个 400px 的最大宽度。
My css
我的CSS
.popover2{display:block!important;width: 400px !important;}
And my html
还有我的 html
<div class="popover popover2 left"><div class="arrow"></div><div class="popover-content"><p>tellus. Donec dui tortor, commodo nec laoreet ac, </p></div></div>
回答by SarathSprakash
回答by saad arshad
use min-heightmax-h css property and overflow:auto
使用min-heightmax-h css 属性和overflow:auto
and usually, if youre using twitter bootstrap, the auto resizing is already taken care of, cross-browserly :)
通常,如果您使用 twitter bootstrap,自动调整大小已经被处理,跨浏览器:)
回答by Kelwin Gamez
You most configure the max-width inside boostrap.min.css. The information is resized automatically with a max width pre-set in the file.
您最常在 boostrap.min.css 中配置 max-width。信息会根据文件中预设的最大宽度自动调整大小。
回答by zvadym
I hope it will be usefull
我希望它会有用
var $btn = $("#my_btn")
.popover()
.on("show.bs.popover", function(e){
p.data("bs.popover").tip().css({"max-width": "500px"});
});

