From 236c997d6d6ca78c27938e2f43ee9f600ed1a9aa Mon Sep 17 00:00:00 2001 From: HWFord <54360213+HWFord@users.noreply.github.com> Date: Wed, 20 Sep 2023 15:47:58 +0200 Subject: [PATCH] fixes #1986 remove document on click the document on click gets all click and triggers more clicks. This has been removed. Too hide a dropdown when we open another, now is specific to clicks on the filters or the filter button. We remove the class and hide the dorpdown if we have clicked on another filter --- themes/default/js/mcs.js | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/themes/default/js/mcs.js b/themes/default/js/mcs.js index 0eaba0070..15296fcd0 100644 --- a/themes/default/js/mcs.js +++ b/themes/default/js/mcs.js @@ -7,28 +7,15 @@ $(document).ready(function () { $(this).find(".validate-text").hide(); }); - $(document).on('click', function (e) { - $(".filter-form").each(function () { - if ($(this).parent().hasClass("show-filter-dropdown")) { - // Filter is open + $("div.filter").on("click", function () { + $(this).siblings().removeClass("show-filter-dropdown"); + $(this).siblings().children("div.filter-form").css('display','none'); + }); - if ($(this).parent().has(e.target).length === 0 && !$(this).parent().is(e.target)) { - // We don't click on a filter or filter's form - // $(this).parent().trigger('click'); + $("div.filter-manager").on("click", function () { + $('div.filter').children("div.filter-form").css('display','none'); + }); - if ($("#addLinkedAlbum").has(e.target).length === 0 && !$("#addLinkedAlbum").is(e.target)) { - console.log("We don't click in filter manager"); - $(this).parent().trigger('click'); - } - - //if target if a filter, open it - if ($(".filter").has(e.target).length !== 0) { - $(e.target).trigger('click'); - } - } - } - }); - }) global_params.search_id = search_id;