Skip to content

Commit

Permalink
Close popups on click outside (CO-2236) (#16)
Browse files Browse the repository at this point in the history
* Close popups on click outside (CO-2236)

* Make popup selector consistent (CO-2236)
  • Loading branch information
arlen authored Oct 12, 2021
1 parent f4b84e6 commit 9e39142
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions app/templates/element/javascript.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,18 @@
}
});

// Hide custom user menu items on click outside
// Click outside behaviors
$(document).on('click', function (e) {
// Hide custom user menu items on click outside
if ($(e.target).closest("#user-panel").length === 0) {
$("#user-panel").hide();
}
// Hide popovers on click outside but don't close current popover when interacting with content inside it
$('#content [data-toggle="popover"]').each(function () {
if (!$(this).is(e.target) && $('.popover.show').has(e.target).length === 0) {
$(this).popover('hide');
}
});
});

// TOP SEARCH FILTER FORM
Expand Down Expand Up @@ -173,9 +180,7 @@
$("select").addClass("form-control");

// Enable Bootstrap Popovers. Unless needed elsewhere, constrain this to #content
$(function () {
$('#content [data-toggle="popover"]').popover()
});
$('#content [data-toggle="popover"]').popover();

// Other buttons (jQuery)
$(".addbutton").button({
Expand Down

0 comments on commit 9e39142

Please sign in to comment.