Skip to content
Snippets Groups Projects
Commit 9dbb86e0 authored by Chris Lawton's avatar Chris Lawton
Browse files

adds active class to select2 checkboxes after page has been filtered

parent ee564958
No related branches found
No related tags found
No related merge requests found
......@@ -53,5 +53,13 @@
});
});
$(function () {
// Add active class to select2 checkboxes after page has been filtered
const clearButtons = document.querySelectorAll('.select2-selection__clear');
clearButtons.forEach(clearButton => {
clearButton.parentElement.parentElement.classList.add('is-active');
});
});
})(jQuery);
......@@ -126,15 +126,6 @@
message.classList.add('messages__text--hide');
});
// Add active class to select2 checkboxes after page has been filtered
document.addEventListener('DOMContentLoaded', () => {
// If there are clear buttons in the dom, it means the filters have been applied
const clearButtons = document.querySelectorAll('.select2-selection__clear');
clearButtons.forEach(clearButton => {
clearButton.parentElement.parentElement.classList.add('is-active');
});
});
// reset mobile filters if they're open past the tablet breakpoint
$(window).resize(function resize() {
if ($(window).width() < 1024) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment