javascript – Can’t find the correct class to close the one-pager WP site mobile menu when anchor link is clicked

Question

could someone help me maybe? I have a one-pager WP site, menu includes anchor links to different parts of the page. The problem is, the mobile/hamburger menu stays open, when anchor links are clicked. I tried to research and fix the problem by applying the code below, that would remove specific class (that is set when the menu is opened) when any link is clicked inside the mobile menu.

But I can’t get it to work.

Here’s the site: https://www.puutax.fi/

and here’s the code:

jQuery(function($) {
    $(".bdt-offcanvas li a").on("click", function(e){
        $("body").removeClass("bdt-open");
    });
});

Any help or pointing to right direction is highly appreciated.

0
Ville Ekman 3 weeks 2023-01-06T07:17:44-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse