Skip to content

Close popups on click outside (CO-2236) #16

Merged
merged 2 commits into from
Oct 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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