如何在Twitter Bootstrap的popover插件中禁用标题? [英] How do you disable the title in Twitter Bootstrap's popover plugin?
问题描述
我正在使用弹出窗口显示不需要标题的图像.如果未设置标题",它仍会显示标题所在的区域.您如何完全关闭此功能?
I'm using popover to display an image which doesn't require a title. If you don't set "title", it still displays an area where the title would be. How do you turn this off completely?
推荐答案
baptme的建议是可以的,但是更好的方法是指定弹出窗口的标题并实际上将其完全隐藏,因为边缘的高度仍为0. >
baptme's suggest is ok, but the better way would be to specify your popover's title and actually hide it completely as margins still exist with a height of 0.
.popover-title { display: none; }
快速查看源代码,似乎有一个未记录的选项:
just quicky looked at the source and there seems to be an undocumented option:
$.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
placement: 'right'
, content: ''
, template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
})
使用JS声明弹出窗口时,请尝试覆盖模板并指定隐藏的标题.
When you declare your popover using JS, try to override the template and specify a hidden title.
$('#example').popover({
template: '...<h3 class="popover-title" style="display: none"></h3>...'
});
我说不删除它的原因是,如果该元素不存在,可能会导致运行时错误.参见Sherbrow的评论.
The reason I say don't remove it is it may cause runtime errors if the element doesn't exist. See Sherbrow's comment.
这篇关于如何在Twitter Bootstrap的popover插件中禁用标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!