-1

After 4.9.9 update my custom JS code for a dropdown menu stopped working.

jQuery(document).ready(function( $ ) {
    // menu mobile
    $(function() {
      $(".e-mobile-menu__main-menu .menu-item-has-children > a").click(function(e) {
        e.preventDefault();
        $(this)
          .next("ul")
          .toggleClass("js-mobile-menu-open");
        $(".e-mobile-menu__main-menu .menu-item-has-children > a")
          .not(this)
          .next("ul")
          .removeClass("js-mobile-menu-open");
        $(".e-mobile-menu__main-menu .menu-item-has-children > a")
          .not(this)
          .removeClass("js-menu-active");
        $(this).toggleClass("js-menu-active");
      });
    });
    // menu desktop
    $(function() {
      $(".c-desktop-menu > div > ul > .menu-item-has-children > a").click(function(
        e
      ) {
        e.preventDefault();
        $(this)
          .next("ul")
          .toggleClass("js-menu-open");
        $(".c-desktop-menu > div > ul > .menu-item-has-children > a")
          .not(this)
          .next("ul")
          .removeClass("js-menu-open");
        $(".c-desktop-menu > div > ul > .menu-item-has-children > a")
          .not(this)
          .removeClass("js-menu-active");
        $(this).toggleClass("js-menu-active");
      });
    });
    });

This is my site: https://www.manufakturamocy.pl/. What's wrong?

1

you do have your menu JS code currently 2 times on the page.

  1. in https://www.manufakturamocy.pl/mm/wp-content/cache/minify/b6a70.default.include-body.8cc603.js
  2. and in https://www.manufakturamocy.pl/mm/wp-content/themes/mmocy/js/script.js?ver=4.9.9

which causes your menu open and close in the same time.

maybe a problem with your cache and JS minify plugin.

  • 1
    Your r right! I have manually selected files to minify and after update to 4.9.9 I had to change ?ver=4.9.8 to 4.9.9 and now everything is great. Thanks!! – Damian Dec 19 '18 at 14:44

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