2

I'm having a problem in using horizontal navigation. When I sort something, at I changes show products with ajax the navigation isn't functional anymore. The click function in jQuery is still working but removeClass and addClass isn't working anymore.

The click function in our jQuery (ajaxlist module):

jQuery(document).on("click", "#horizontal-layered-navigation-container div.horizontal-filter .filter-title", function(e) {
    e.preventDefault();
    _is_expanded = jQuery(this).hasClass("horizontal-filter-title-expanded");
    jQuery("#horizontal-layered-navigation-container div.horizontal-filter .filter-title.horizontal-filter-title-expanded, #horizontal-layered-navigation-container div.horizontal-filter .filter-content.horizontal-filter-content-expanded").removeClass('horizontal-filter-title-expanded horizontal-filter-content-expanded');
    if (!_is_expanded) {
        jQuery(this).next('div.filter-content').addClass('horizontal-filter-content-expanded');
        jQuery(this).addClass('horizontal-filter-title-expanded');
    }
    window._open_horizontal_dropdown = true;
});

Link when sorting works: /mand and after ajaxcall and sorting is broken /mand#brands=701,419,882

Hope some of you can figure out why the body of the if-statement suddenly isn't working :)

  • Tell me if you need anything else then the jquery click-function – Kevin Steen Hansen Apr 3 at 6:10
  • Is your if condition working? – Prathap Gunasekaran Apr 4 at 12:43
  • Its seems like it is. And _is_expanded is set, but forgot after each click – Kevin Steen Hansen Apr 4 at 12:52
  • 1
    The question cannot be reproduced, that's why no answer is coming, please be precise of what you want, then only some one can give answer to you – Prathap Gunasekaran Apr 4 at 12:54
  • @PrathapGunasekaran the if-statement is working. Its printing a console.log inside the ifstatement. Link when sorting works: /mand and after ajaxcall and sorting is broken /mand#brands=701,419,882 – Kevin Steen Hansen Apr 4 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.