If anyone can help me with how to close active accordion of layered navigation if clicked outside the layered navigation block?

 <div class="filter-options" id="narrow-by-list" data-role="content" data-mage-init='{"accordion":{"openedState": "active", "collapsible": true, "active": false, "multipleCollapsible": false}}'>

this is the default accordion which is collapsible.

1 Answer 1


Got the solution. Create a new js file and include it or edit any theme js file. Add below code.

/*Close Layered Navigation on side click*/
$(document).click(function(e) {
    if (!$( "#narrow-by-list" ).is(e.target) && !$( "#narrow-by-list" ).has(e.target).length) {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.