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

后端 未结 5 1956
悲哀的现实
悲哀的现实 2021-02-18 13:54

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 of

5条回答
  •  花落未央
    2021-02-18 14:19

    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: '

    ' })

    When you declare your popover using JS, try to override the template and specify a hidden title.

    $('#example').popover({
        template: '......'
    });
    

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

提交回复
热议问题