Close off-canvas menu in anchor link, one page website

Paste below code at Code Block

jQuery(document).ready(function($) {
  $("body").on("click", ".oxy-pro-menu-list > li > a", function(e) {
    let currentPathname = window.location.href.split("://").pop();
    let urlClickedOn = this.href.split("://").pop();

    if (currentPathname.split("#").shift() == urlClickedOn.split("#").shift()) {
      $(this).parents('.oxy-pro-menu').removeClass('oxy-pro-menu-open');
      $(this).parents('.oxy-pro-menu-container').removeClass('oxy-pro-menu-open-container');
      $('.oxy-nav-menu-prevent-overflow').removeClass('oxy-nav-menu-prevent-overflow');

      if ($(this).parents('.oxy-pro-menu-container').hasClass('oxy-pro-menu-off-canvas-container')) {
        oxygen_offcanvas_menu_run($(this).parents('.oxy-pro-menu'));
      }
    }
  });
});

Source: https://github.com/

Copyright © 2023 Siam Naulak.
magnifiercrossmenu