if ($(window).width() < 991) { $('#primary-menu-trigger,#overlay-menu-close').on('click',function() { $('.drawer-bg').show(); $('.mobile-drawer').addClass('show'); $('.filter-bg').hide(); $('.mobile-filter').removeClass('show'); }); $('.drawer-bg, .close-drawer').on('click',function(){ $('.drawer-bg').hide(); $('.mobile-drawer').removeClass('show'); // $('.mobile-drawer-content').removeClass('show'); }); /*filter*/ $('#filter-trigger').on('click',function() { $('.filter-bg').show(); $('.mobile-filter').addClass('show'); $('.drawer-bg').hide(); $('.mobile-drawer').removeClass('show'); }); $('.filter-bg, .close-filter').on('click',function(){ $('.filter-bg').hide(); $('.mobile-filter').removeClass('show'); // $('.mobile-drawer-content').removeClass('show'); }); /*filter*/ $('.mobile-drawer .navigation > ul > li, .mobile-drawer .navigation > ul > li > ul > li').has('ul').addClass('submenu'); $('.mobile-drawer .currencySection ul > li:has(ul) > a').append( '' ); // $('.mobile-drawer-content').closest('.submenu').addClass('categoryLink'); // $('.submenu').on('click',function(e){ // e.preventDefault(); // var show = $(this).hasClass('show'); // var categoryLink = $(this).hasClass('category-link'); // if(categoryLink){ // $('.mobile-drawer-content').addClass('show'); // }else{ // if(show){ // $(this).removeClass('show'); // $(this).find('ul:first').slideUp(); // var href = $(this).find('a').data('link'); // var linktarget = $(this).find('a').attr('target'); // if(linktarget == '_blank'){ // window.open(href); // }else{ // window.location.href = href; // } // }else{ // $(this).addClass('show'); // $(this).find('ul:first').slideDown(); // } // $('.mobile-drawer-content').removeClass('show'); // } // e.stopPropagation(); // }); // Toggle submenu when clicking the top-level in .submenu $('.submenu > a .toggle-icon').on('click', function(e) { e.preventDefault(); var $parent = $(this).closest('.submenu'); var $icon = $(this); var show = $parent.hasClass('show'); if (show) { $parent.removeClass('show').find('ul:first').slideUp(); $icon.removeClass('fa-minus').addClass('fa-plus'); } else { $('.submenu').removeClass('show').find('ul:first').slideUp(); $('.submenu .toggle-icon').removeClass('fa-minus').addClass('fa-plus'); $parent.addClass('show').find('ul:first').slideDown(); $icon.removeClass('fa-plus').addClass('fa-minus'); } e.stopPropagation(); }); // Allow submenu links to work normally $('.submenu ul a').on('click', function(e) { // This will just follow the link, no interference e.stopPropagation(); // Prevent closing menu unintentionally }); $('.menu-togggle').on('click',function(){ var show = $(this).find('i').hasClass('.fa fa-plus'); if(show){ $(this).find('i').removeClass('.fa fa-plus').addClass('.fa fa-minus'); $(this).closest('.category-menu').find('ul:first').slideUp(); }else{ $(this).find('i').removeClass('.fa fa-plus').addClass('.fa fa-minus'); $(this).closest('.category-menu').find('ul:first').slideDown(); } }); $('.category-name').on('click',function(){ var href = $(this).attr('href'); var linktarget = $(this).attr('target'); if(linktarget == '_blank'){ window.open(href); }else{ window.location.href = href; } }); $('.category-menu > ul > li > a').on('click',function(){ var href = $(this).attr('href'); var linktarget = $(this).attr('target'); if(linktarget == '_blank'){ window.open(href); }else{ window.location.href = href; } }); $('.submenu > ul ').on('click',function(){ e.preventDefault(); var show = $(this).hasClass('show'); e.stopPropagation(); }); $('.mobile-drawer .currencySection ul > li:has(ul)').on('click',function(e){ // e.preventDefault(); var show = $(this).hasClass('show'); if(show){ $(this).removeClass('show'); $(this).find('ul:first').slideUp(); }else{ $(this).addClass('show'); $(this).find('ul:first').slideDown(); } }); $(window).resize(function(){ if($(window).width() > 991){ $('.mobile-drawer').removeClass('show'); $('.mobile-drawer-content').removeClass('show'); $('.mobile-filter').removeClass('show'); $('.mobile-filter-content').removeClass('show'); } }); } else { $(window).resize(function(){ if($(window).width() > 991){ $('.mobile-drawer').removeClass('show'); $('.mobile-drawer-content').removeClass('show'); $('.mobile-filter').removeClass('show'); $('.mobile-filter-content').removeClass('show'); } }); } // $('#primary-menu-trigger,#overlay-menu-close').on('click',function() { // $('.drawer-bg').show(); // $('.mobile-drawer').addClass('show'); // }); // $('.drawer-bg, .close-drawer').on('click',function(){ // $('.drawer-bg').hide(); // $('.mobile-drawer').removeClass('show'); // // $('.mobile-drawer-content').removeClass('show'); // }); // $('.mobile-drawer .navigation > ul > li, .mobile-drawer .navigation > ul > li > ul > li').has('ul').addClass('submenu'); // $('.mobile-drawer .currencySection ul > li:has(ul) > a').append( '' ); // // $('.mobile-drawer-content').closest('.submenu').addClass('categoryLink'); // $('.submenu').on('click',function(e){ // e.preventDefault(); // var show = $(this).hasClass('show'); // var categoryLink = $(this).hasClass('category-link'); // if(categoryLink){ // $('.mobile-drawer-content').addClass('show'); // }else{ // if(show){ // $(this).removeClass('show'); // $(this).find('ul:first').slideUp(); // var href = $(this).find('a').data('link'); // window.location.href = href; // }else{ // $(this).addClass('show'); // $(this).find('ul:first').slideDown(); // } // $('.mobile-drawer-content').removeClass('show'); // } // e.stopPropagation(); // }); // $('.menu-togggle').on('click',function(){ // var show = $(this).find('i').hasClass('.fa fa-chevron-up'); // if(show){ // $(this).find('i').removeClass('.fa fa-chevron-up').addClass('.fa fa-chevron-down'); // $(this).closest('.category-menu').find('ul:first').slideUp(); // }else{ // $(this).find('i').removeClass('.fa fa-chevron-down').addClass('.fa fa-chevron-up'); // $(this).closest('.category-menu').find('ul:first').slideDown(); // } // }); // $('.category-name').on('click',function(){ // var href = $(this).attr('href'); // window.location.href= href; // }); // $('.category-menu > ul > li > a').on('click',function(){ // var href = $(this).attr('href'); // window.location.href= href; // }); // $('.submenu > ul ').on('click',function(){ // e.preventDefault(); // var show = $(this).hasClass('show'); // e.stopPropagation(); // }); // $('.mobile-drawer .currencySection ul > li:has(ul)').on('click',function(e){ // // e.preventDefault(); // var show = $(this).hasClass('show'); // if(show){ // $(this).removeClass('show'); // $(this).find('ul:first').slideUp(); // }else{ // $(this).addClass('show'); // $(this).find('ul:first').slideDown(); // } // }); // $(window).resize(function(){ // if($(window).width() > 991){ // $('.mobile-drawer').removeClass('show'); // $('.mobile-drawer-content').removeClass('show'); // } // });