Created
January 26, 2017 17:01
-
-
Save Farmatique/eb342bd79af331bb256d19055bf13f7d to your computer and use it in GitHub Desktop.
Bootstrap 3.3.6 close popver by clicking outside of it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(document).on('click', function (e) { | |
| $('[data-toggle="popover"],[data-original-title]').each(function () { | |
| //the 'is' for buttons that trigger popups | |
| //the 'has' for icons within a button that triggers a popup | |
| if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) { | |
| (($(this).popover('hide').data('bs.popover')||{}).inState||{}).click = false // fix for BS 3.3.6 | |
| } | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment