LoginSignup
10
9

More than 5 years have passed since last update.

Bootstrap3のpopoverで外側のどこをクリックしても閉じるようにする

Posted at

以下を追加するだけ。

$('body').on('click', function(e) {
    $('.pointer').each(function() {
        if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
            $(this).popover('hide');
        }
    });
});

引用:http://jsfiddle.net/mattdlockyer/C5GBU/2/

10
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
9