4,114
edits
No edit summary |
No edit summary |
||
Line 174: | Line 174: | ||
// Function to check if filters are cleared for given selectors and update visibility of corresponding community elements | // Function to check if filters are cleared for given selectors and update visibility of corresponding community elements | ||
function updateCommunityElementsVisibility(selectors, communityElements) { | |||
for (var i = 0; i < selectors.length; i++) { | |||
var selector = selectors[i]; | |||
var communityElement = communityElements[i]; // Access the corresponding community element | |||
var checkedFilters = $(selector + ' .filtered-value-option input[type="checkbox"]:checked'); | |||
console.log(`Checked filters count in ${selector}:`, checkedFilters.length); | |||
// If no filters are checked, show the community element associated with this selector | |||
if (checkedFilters.length === 0) { | |||
console.log(`All filters are cleared in ${selector}`); | |||
communityElement.show(); | |||
} else { | |||
console.log(`Some filters are still active in ${selector}`); | |||
communityElement.hide(); // Hide the community element if any filters are active | |||
} | |||
} | |||
} | |||