javascript - Custom JS doesn't work after 4.9.9 update

admin2025-06-05  7

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 6 years ago.

Improve this question

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: /. What's wrong?

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 6 years ago.

Improve this question

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?

Share Improve this question edited Dec 19, 2018 at 14:26 RiddleMeThis 3,8078 gold badges22 silver badges30 bronze badges asked Dec 19, 2018 at 14:22 DamianDamian 971 gold badge1 silver badge11 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 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.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749084394a316227.html

最新回复(0)