wordpress/php-fpm/wordpress_files/themes/simple-catch/js/menu.min.js

1 line
1.8 KiB
JavaScript
Raw Permalink Normal View History

2020-05-22 03:40:23 +02:00
!function(e){function n(n){var t=e("<button />",{"class":"dropdown-toggle","aria-expanded":!1}).append(e("<span />",{"class":"screen-reader-text",text:screenReaderText.expand}));n.find(".menu-item-has-children > a").after(t),n.find(".current-menu-ancestor > button").addClass("toggled-on"),n.find(".current-menu-ancestor > .sub-menu").addClass("toggled-on"),n.find(".menu-item-has-children").attr("aria-haspopup","true"),n.find(".dropdown-toggle").click(function(n){var t=e(this),a=t.find(".screen-reader-text");n.preventDefault(),t.toggleClass("toggled-on"),t.next(".children, .sub-menu").toggleClass("toggled-on"),t.attr("aria-expanded","false"===t.attr("aria-expanded")?"true":"false"),a.text(a.text()===screenReaderText.expand?screenReaderText.collapse:screenReaderText.expand)})}var t,a,s,i;n(e(".main-navigation")),t=e("#masthead"),a=t.find("#menu-toggle"),i=t.find("#site-header-menu"),s=t.find("#access"),function(){a.length&&(a.add(s).attr("aria-expanded","false"),a.on("click.simplecatch",function(){e(this).add(i).toggleClass("toggled-on"),e(this).add(s).attr("aria-expanded","false"===e(this).add(s).attr("aria-expanded")?"true":"false")}))}(),function(){function n(){window.innerWidth>=910?(e(document.body).on("touchstart.simplecatch",function(n){e(n.target).closest(".main-navigation li").length||e(".menu-header-container li").removeClass("focus")}),s.find(".menu-item-has-children > a").on("touchstart.simplecatch",function(n){var t=e(this).parent("li");t.hasClass("focus")||(n.preventDefault(),t.toggleClass("focus"),t.siblings(".focus").removeClass("focus"))})):s.find(".menu-item-has-children > a").unbind("touchstart.simplecatch")}s.length&&s.children().length&&("ontouchstart"in window&&(e(window).on("resize.simplecatch",n),n()),s.find("a").on("focus.simplecatch blur.simplecatch",function(){e(this).parents(".menu-item").toggleClass("focus")}))}()}(jQuery);