Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap .popover() 'show' & 'destroy' not working properly

When I use the bootstrap popover in 'manual' mode 'destroy' and 'hide' not working properly. When I'm using hide and destroy, popover opacity changing to 0 but its not changing display to none, which resulting that the popover container cover the content bellow it. Otherwise if I use 'toogle' mode it's working properly.

My code:

$('[rel="popover"]').popover({
    html: true,
    placement: 'auto',
    container: 'body',
    trigger: 'manual'
});

$('body').on('click' , '[rel="popover"]' , function(e){
    e.stopPropagation();
    $(this).popover('toggle');
});

$('body').on('click' , '.popoverClose' , function(e){
    e.stopPropagation();
    var i = $(this);
    $('.inputInfo').filter('[data-info-id="' +i.data('info-id')+ '"]').popover('hide');
});

// new code
$('body').on('click', function(){
    $('[rel="popover"]').popover('hide');
});
like image 766
LJ Wadowski Avatar asked Jan 17 '14 16:01

LJ Wadowski


1 Answers

My temporary solution look like this:

I'm using:

$('.popover').remove();

to remove popovers

and

$('body').on('click' , '[rel="popover"]' , function(e){
    e.stopPropagation();

    var i = $(this);
    var thisPopover = $('.popoverClose').filter('[data-info-id="' +i.data('info-id')+ '"]').closest('.popover');        
    if( thisPopover.is(':visible') ){
        $('.popover').remove();
    }
    else{
        $(this).popover('show');
    }
});

to toggle popovers

like image 195
LJ Wadowski Avatar answered Oct 17 '22 19:10

LJ Wadowski