1/* global woodmart_settings */ 2(function($) { 3 woodmartThemeModule.menuSetUp = function() { 4 var hasChildClass = 'menu-item-has-children', 5 mainMenu = $('.wd-nav, .wd-header-cats'), 6 openedClass = 'wd-opened'; 7 8 $('.mobile-nav').find('ul.wd-nav-mobile').find(' > li').has('.wd-dropdown-menu').addClass(hasChildClass); 9 10 woodmartThemeModule.$document.on('click', '.wd-nav .wd-event-click > a, .wd-header-cats.wd-event-click > span', function(e) { 11 e.preventDefault(); 12 var $this = $(this); 13 14 if ($this.parent().siblings().hasClass(openedClass)) { 15 $this.parent().siblings().removeClass(openedClass); 16 } 17 18 $this.parent().toggleClass(openedClass); 19 }); 20 21 woodmartThemeModule.$document.on('click', function(e) { 22 var target = e.target; 23 24 if ($('.' + openedClass).length > 0 && !$(target).is('.wd-event-hover') && !$(target).parents().is('.wd-event-hover') && !$(target).parents().is('.' + openedClass + '') && !$(target).is('.' + openedClass + '')) { 25 mainMenu.find('.wd-event-click.' + openedClass + '').removeClass(openedClass); 26 27 if (mainMenu.hasClass('wd-event-click')) { 28 mainMenu.removeClass(openedClass); 29 } 30 31 $('.wd-close-side').removeClass('wd-close-side-opened wd-location-header'); 32 } 33 }); 34 35 // woodmartThemeModule.$document.on('mouseover', '.wd-header-cats.wd-open-dropdown > .wd-dropdown', function() { 36 // $(this).parents('.wd-header-cats').removeClass('wd-open-dropdown'); 37 // }); 38 39 if ('yes' === woodmart_settings.menu_item_hover_to_click_on_responsive) { 40 function menuIpadClick() { 41 if (woodmartThemeModule.$window.width() <= 1024) { 42 mainMenu.find(' > .menu-item-has-children.wd-event-hover').each(function() { 43 $(this).data('original-event', 'hover').removeClass('wd-event-hover').addClass('wd-event-click'); 44 }); 45 } else { 46 mainMenu.find(' > .wd-event-click').each(function() { 47 var $this = $(this); 48 49 if ($this.data('original-event') === 'hover') { 50 $this.removeClass('wd-event-click').addClass('wd-event-hover'); 51 } 52 }); 53 } 54 } 55 56 menuIpadClick(); 57 58 woodmartThemeModule.$window.on('resize', woodmartThemeModule.debounce(function() { 59 menuIpadClick(); 60 }, 300)); 61 } 62 }; 63 64 $(document).ready(function() { 65 woodmartThemeModule.menuSetUp(); 66 }); 67})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.