Created
December 8, 2013 09:54
-
-
Save faridnsh/7855369 to your computer and use it in GitHub Desktop.
Close popover when the body is clicked on, while using bootstrap popover.
This file contains 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
var path = '#thePopoverContent', | |
element = $('#theButtonThatOpensThePopover')[0]; | |
$(document).click(function (e) { | |
if (this !== element && | |
e.target !== element && | |
$('.popover').length && | |
!$(e.target).parents(path).length) { | |
hide(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment