hand-detection/assets/scripts/horizontal-menu.min.js

2 lines
1.2 KiB
JavaScript

!function(t){"use strict";function n(n){return"rtl"==t("html").attr("dir")?t(".mega").each(function(){var e=t(this),a=(e.outerWidth(),e.offset().left),o=t(".nav-horizontal .container").outerWidth()-40,i=(n-o)/2;i>a&&e.css({right:-i})}):t(".mega").each(function(){var e=t(this),a=e.outerWidth(),o=e.offset().left,i=t(".nav-horizontal .container").outerWidth()-40,r=n-(n-i)/2;a+o>r&&e.css({left:r-a-o})}),!1}t(document).ready(function(){var e=t(window).width();return e>1024&&n(e),!1}),t(window).on("resize",function(){var e=t(window).width();return e>1024?n(e):t(".nav .sub-menu").attr("style",""),!1}),t(".nav .menu a,.nav .menu h3").on("click",function(n){var e=t(this),a=e.next();e.next().length&&(n.preventDefault(),t(window).width()<1025&&(a.stop().slideToggle(200),e.toggleClass("active")))}),t(".js__menu_button").on("click",function(){return t(".nav").toggleClass("active"),!1}),t(".js__close_menu").on("click",function(){return t(".nav").removeClass("active"),!1}),t("#wrapper").on("click",function(n){var e=t(n.target);e.hasClass("nav")||e.hasClass("js__menu_button")||e.parents(".nav").length||e.parents(".js__menu_button").length||t(".nav").removeClass("active")})}(jQuery);