$(document).ready(function () { if ($('.main-header .FH').length){ // BASE MENU $('ul.base-menu').show(); }; // LEVEL DEPTH FOR MOBILE if($(window).width() < 1090) { var fullMenu = ''; $('ul.base-menu li.ifDrop').each(function(){ fullMenu = fullMenu + '
  • '+$(this).html()+'
  • '; }); $('ul.base-menu li.all-product-button').remove(); $('.nav-menu.base-menu').prepend(fullMenu); } // FIXED HEADER function fixNav(){ if (!$('.cart-menu').length && !$('.-g-template-black-friday').length){ var nav = $('.main-header'); var pos = nav.height(); var posDelay = nav.height()*2; var prevScroll = 0; nav.addClass('fix-nav'); $(window).scroll(function () { var fix = ($(this).scrollTop() > posDelay) ? true : false; if(fix){ nav.addClass('fade-menu', fix); setTimeout(function() { nav.addClass('animate-menu'); }, 250); $('body').css('margin-top', pos); if($(this).scrollTop() > prevScroll){ nav.removeClass('active-menu'); }else{ nav.addClass('active-menu'); } }else{ $('body').css('margin-top', 0); nav.removeClass('fade-menu active-menu animate-menu', fix); } prevScroll = $(this).scrollTop(); }); } } $.Gomag.bind('Widget/Add/After', function(){ fixNav(); // BF SIDEBAR + MENU STICKY if($('.-g-template-black-friday').length){ $('.main-header').css({'top' : '-' + ($('.discount-tape').height() + $('.top-head-bg').height()) + 'px'}); } if($( window ).width() > 991 && $('.-g-template-black-friday').length){ $('.landing-h .side-menu.fixed').css({'top' : $('#navigation').outerHeight() + 20 + 'px'}); } }) // ITC MENU ========== function buildMenu(){ $('.main-header .__ignoreSubmenu').each(function() { var $this = $(this); if ($this.find('li').length > 20){ $this.addClass('col3'); }else if ($this.find('li').length >= 11){ $this.addClass('col2'); }else if ($this.find('li').length < 10){ $this.addClass('col1'); }else{} }); }; buildMenu(); $('.main-header .menu-drop').hover(function() { $(this).find('.menu-dd').addClass('visible'); if ( $('.slide-item-menu').length ) { $('.slide-item-menu').owlCarousel({items:1,navigation:!0,pagination:!1}); var owl = $('.slide-item-menu'); // get owl element var owlInstance = owl.data('owlCarousel'); // get owl instance from element if(owlInstance != null) // if instance is existing owlInstance.reinit(); $.Gomag.eqProductRow(); }; }, function(){ $(this).find('.menu-dd').removeClass('visible'); }); $('.main-header ul.nav-menu li.ifDrop').has('ul.drop-list').addClass('drop-parent'); $('.main-header .drop-parent').hover(function() { $(this).find('.drop-list').addClass('visible'); $(this).find('.drop-list').show(); var itemNumber = $(this).find('.col').length, itemWidth = $(this).find('.col').outerWidth(), elemCount = $(this).find('.drop-list li a').length, imgCount = $(this).find('.drop-list .image').length; if(elemCount < 10 && imgCount == 0){ $('.menu-dd').css({"padding-right" : "0px", "width" : itemWidth + 258 + "px"}); } else{ $('.menu-dd').css({"padding-right" : "0px", "width" : itemNumber * itemWidth + 258 + "px"}); } },function() { $(this).find('.drop-list').removeClass('visible'); $(this).find('.drop-list').hide(); $('.menu-dd').css({"width" : 255 + "px"}); }) }); /* deajoaca js file */ /* BUTON REVIEW */ window.setTimeout( function() { $('#addReview').clone().removeClass('std').addClass('review-small').appendTo('.__reviewTitle'); }, 1500 ); document.querySelector('meta[name="viewport"]').setAttribute("content", "width=device-width, initial-scale=1.0, user-scalable=yes"); $('div[data-block="FooterAffiliateBlock"]').insertAfter('div[data-block="FooterCopyrightBlock"]'); function caroChange(){ if($('.slide-item-4').length){ $('.slide-item-4').addClass('slide-item-6').removeClass('slide-item-4'); // $('.slide-item-4').data('owlCarousel').destroy(); } if($('.slide-item-component').length){ $('.slide-item-component').addClass('slide-item-6').removeClass('slide-item-component'); // $('.slide-item-4').data('owlCarousel').destroy(); } if($('.slide-item-6').length){ $('.slide-item-6').owlCarousel({ items: 6, navigation:true, pagination:true, itemsCustom : [ [0,2], [479,2], [768,3], [979,4], [1099,5], [1199,6] ] }); }; } caroChange(); function caroChangeLastVizit(){ if($('.slide-item-recent').length){ $('.slide-item-recent').addClass('slide-item-6'); $('.slide-item-recent').data('owlCarousel').destroy(); $('.slide-item-recent').owlCarousel({ items: 6, navigation:true, pagination:true, itemsCustom : [ [0,2], [479,2], [768,3], [979,4], [1099,5], [1199,6] ] }); } }; function productDet(){ if($('#product-page').length){ // stock if( $('#product-page .detail-product-atributes .stock-status').length && $('#product-page .detail-prod-attr .detail-price').length ){ $('#product-page .detail-product-atributes .stock-status').addClass('el-changed').insertAfter('#product-page .detail-prod-attr .detail-price'); } // add to cart if( $('#product-page .detail-prod-attr .add-section').length && $('#product-page .detail-prod-attr .stock-status').length ){ $('#product-page .detail-prod-attr .add-section').addClass('el-changed').insertAfter('#product-page .detail-prod-attr .stock-status'); }else if( $('#product-page .detail-prod-attr .add-section').length && $('#product-page .detail-prod-attr .detail-price').length ){ $('#product-page .detail-prod-attr .add-section').addClass('el-changed').insertAfter('#product-page .detail-prod-attr .detail-price'); } // product code if( $('#product-page .detail-prod-attr .product-code').length && $('#product-page .detail-prod-attr .add-section').length ){ $('#product-page .detail-prod-attr .product-code').addClass('el-changed').insertAfter('#product-page .detail-prod-attr .add-section'); }else if( $('#product-page .detail-prod-attr .product-code').length && $('#product-page .detail-prod-attr .detail-price').length ){ $('#product-page .detail-prod-attr .product-code').addClass('el-changed').insertAfter('#product-page .detail-prod-attr .detail-price'); } // transport-info if( $('#product-page .detail-prod-attr .transport-info').length && $('#product-page .detail-prod-attr .product-code').length ){ $('#product-page .detail-prod-attr .transport-info').addClass('el-changed').insertAfter('#product-page .detail-prod-attr .product-code'); }else if( $('#product-page .detail-prod-attr .transport-info').length && $('#product-page .detail-prod-attr .detail-price').length ){ $('#product-page .detail-prod-attr .transport-info').addClass('el-changed').insertAfter('#product-page .detail-prod-attr .detail-price'); } // transport-info time if( $('#product-page .detail-prod-attr .__shippingDeliveryTime').length && $('#product-page .detail-prod-attr .transport-info').length ){ $('#product-page .detail-prod-attr .__shippingDeliveryTime').addClass('el-changed').appendTo('#product-page .detail-prod-attr .transport-info'); $('#product-page .detail-prod-attr .transport-info').addClass('with-shippingDelivery'); }else if( $('#product-page .detail-prod-attr .__shippingDeliveryTime').length && $('#product-page .detail-prod-attr .detail-price').length ){ $('#product-page .detail-prod-attr .__shippingDeliveryTime').addClass('el-changed').insertAfter('#product-page .detail-prod-attr .detail-price'); } // wish-section if( $('#product-page .detail-prod-attr .wish-section').length && $('#product-page .detail-prod-attr .product-code').length ){ $('#product-page .detail-prod-attr .wish-section').addClass('el-changed').insertAfter('#product-page .detail-prod-attr .product-code'); }else if( $('#product-page .detail-prod-attr .wish-section').length && $('#product-page .detail-prod-attr .add-section').length ){ $('#product-page .detail-prod-attr .wish-section').addClass('el-changed').insertAfter('#product-page .detail-prod-attr .add-section'); } } } productDet(); var rtgSwiper = ''; var rtgSwiperWrapper = ''; function initSwiper() { if($('.rtg-swiper-container .swiper-wrapper .swiper-slide').length){ //console.log(1); //$('.rtg-swiper-container .swiper-wrapper .swiper-slide').removeAttr('style'); $('.rtg-swiper-container').each(function(e){ rtgSwiper = $(this); rtgSwiper.removeAttr('class').addClass('rtg-swiper-container'); //console.log(rtgSwiper); rtgSwiper.find('.swiper-wrapper .swiper-slide').removeAttr('role aria-label style'); //rtgSwiper.destroy(); // rtgSwiperWrapper = new Swiper(rtgSwiper, { // slidesPerView: 6, // spaceBetween: 10, // breakpoints: { // // when window width is >= 320px // 320: { // slidesPerView: 2, // spaceBetween: 20 // }, // // when window width is >= 480px // 480: { // slidesPerView: 2, // spaceBetween: 30 // }, // // when window width is >= 640px // 640: { // slidesPerView: 3, // spaceBetween: 40 // }, // // when window width is >= 768px // 768: { // slidesPerView: 3, // spaceBetween: 40 // }, // // when window width is >= 1024px // 1024: { // slidesPerView: 4, // spaceBetween: 40 // }, // // when window width is >= 1280px // 1280: { // slidesPerView: 6, // spaceBetween: 40 // } // } // }); }); } } $(window).load(function(){ initSwiper(); }); $(document).ajaxComplete(function(){ productDet(); }); $(document).ajaxStop(function(){ initSwiper(); caroChangeLastVizit(); setTimeout(function(){ initSwiper(); },1000); setTimeout(function(){ initSwiper(); },2000); setTimeout(function(){ initSwiper(); },3000); }); $(document).on('Gomag.ajaxContentLoaded', function(event, data){ })