user930026
user930026

Reputation: 1657

Angular Bootstrap Popover Open only 1 Popover at a time and close all if clicked anywhere else

Under the title "metrics" there is a PROGRESS bar on click of progress bar a POPOVER opens I anticipate to have only 1 popover opened at a time. i.e for eg: if 1 popup is open already so on click of second the other opened one should close automatically. [http://puu.sh/jjWne/053c884555.png][1] here like both are opened at a time whereas 1 should only open. Here is the link

I have to paste url as this is ajax based

Upvotes: 1

Views: 511

Answers (1)

Nagesh Sanika
Nagesh Sanika

Reputation: 1100

I faced this problem long time back,

use this script to hide popovers when you click on outside.

$(document).on('click','body',function (e) {
    $('[data-toggle="popover"]').each(function () { 
        if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
            $(this).popover('hide');
        }
    });
});

hope it works for you.

Upvotes: 3

Related Questions