Search code examples
twitter-bootstraptwitter-bootstrap-3tooltippopover

Prevent showing tooltip on popover


I need < a > tag which shoud display tooltip on cursor moving and should drop popover on clicking. But tooltip is also shown when I move cursor above popover. Check it: https://jsfiddle.net/ivictbor/re15cuby/2/ .

Html:

 <span data-toggle="tooltip" data-placement="bottom" title="sometext"> 
    <a id="my_uniq_id" href="javascript:void(0);" >          
        link</a>
   </span>

JS:

$( "#my_uniq_id" ).on( "click", function drop_popover() {
 id = 'my_uniq_id'
 var el = $("#"+id);
 $( "body" ).append(
        '<div id="' +id+'_hldr'+'" style="display: none;">'+
          'popover holder code'+
        '</div>'
 );
 el.popover({ 
        placement : 'bottom',
        html : true,
        trigger: 'manual',
        title: ': <a href="#" style="float:right;"><span class="glyphicon glyphicon-remove-circle" '+
        'onclick="$(\'#'+id+'\').popover(\'hide\');"></span></a>',
        content: function() {
          return $('#'+id+'_hldr').html();
        },
    }).click(function(e) {
        e.preventDefault();
    });
    el.popover('show');
})

$(function () {
  $('[data-toggle="tooltip"]').tooltip({html: true})
})

Solution

  • Need to add 'container: 'body'' in popover options:

    el.popover({ 
        placement : 'bottom',
        container: 'body',
        html : true,
    

    Thanks to cvrebert