Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you disable the title in Twitter Bootstrap's popover plugin?

Tags:

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?

like image 591
Scott C Wilson Avatar asked Jun 27 '12 11:06

Scott C Wilson


People also ask

How do I disable popover?

To hide the displayed popover, use the popover(“hide”) method.

What is the difference between Tooltip and popover?

Tooltip: use tooltips to show a short text to respondents when they hover over a word or icon. Popover: use popovers to show a longer text, or when you want to have a link to an external web page. It is shown when the respondent clicks on a word or icon.

How do I style bootstrap popover?

If you have multiple popovers on your page and only want to style one of them, you can leverage the popover's template option to add another class: $("#myElement"). popover({ template: '<div class="popover my-specific-popover" role="tooltip">...' });

How do I show popover on hover?

Set the trigger option of the popover to hover instead of click , which is the default one. Or with an initialization option: $("#popover"). popover({ trigger: "hover" });


1 Answers

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; } 

Edit: 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>'   }) 

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>...' }); 

The reason I say don't remove it is it may cause runtime errors if the element doesn't exist. See Sherbrow's comment.

like image 97
Terry Avatar answered Jan 15 '23 02:01

Terry