$(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"}); }) }); /** * Scrie aici codul tau Javascript... */ /* www.dualstore.ro CSS */ /* Daly custom */ /* GOMK-43185 */ if($(window).width() > 768){ $('.detail-recomended').appendTo('.product-bottom .row'); } var sectPos = jQuery(window).scrollTop(); var winH = jQuery(window).height(); var lazyImg = 'https://gomagcdn.ro/themes/fashion/gfx/svg/imgDots.svg'; function lazyIframes() { if ($('div[data-oembed-url] iframe').length){ $('div[data-oembed-url] iframe').each(function () { if(!$(this).hasClass('cls-iframe-loading-lazy')){ var getThisAttrLazy = $(this).attr('loading'); var getThisAttrSrc = $(this).attr('src'); $(this).attr('src',lazyImg); if (typeof getThisAttrLazy == 'undefined') { $(this).addClass('cls-iframe-loading-lazy cls-iframe-oembed').attr('loading', 'lazy').attr('data-originsrc', getThisAttrSrc); } } if(!$(this).hasClass('scroll-lazy')){ var sect_top_pos = $(this).offset().top; if((sect_top_pos-winH) >= sectPos){ //$(this).removeClass('scroll-lazy'); }else{ var getCurrentOriginSrc = $(this).attr('data-originsrc'); if(typeof getCurrentOriginSrc !== 'undefined'){ $(this).addClass('scroll-lazy').attr('src',getCurrentOriginSrc); } } } }) } if ($('.box-video iframe').length) { $('.box-video iframe').each(function () { if(!$(this).hasClass('cls-iframe-loading-lazy')){ var getThisAttrLazy = $(this).attr('loading'); var getThisAttrSrc = $(this).attr('src'); $(this).attr('src',lazyImg); if (typeof getThisAttrLazy == 'undefined') { $(this).addClass('cls-iframe-loading-lazy cls-iframe-boxvideo').attr('loading', 'lazy').attr('data-originsrc', getThisAttrSrc); } } if(!$(this).hasClass('scroll-lazy')){ var sect_top_pos = $(this).offset().top; if((sect_top_pos-winH) >= sectPos){ //$(this).removeClass('scroll-lazy'); }else{ var getCurrentOriginSrc = $(this).attr('data-originsrc'); if(typeof getCurrentOriginSrc !== 'undefined'){ $(this).addClass('scroll-lazy').attr('src',getCurrentOriginSrc); } } } }) } } lazyIframes(); $(document).ready(function () { /* De eliminat dupa restore */ /* if($('#product-page').length > 0) { $('.detail-tabs #resp-tab ul.resp-tabs-list li:nth-child(2)').click(); }*/ /* ENDS De eliminat dupa restore */ $.fn.isInViewport = function () { var elementTop = $(this).offset().top; var elementBottom = elementTop + $(this).outerHeight(); var viewportTop = $(window).scrollTop(); var viewportBottom = viewportTop + $(window).height(); return elementBottom > viewportTop; }; if ($('#sticky-atc').length < 1 && $('#product-page .add-section').length) { var whatsAppFloatInitialHeight = parseInt($('a.whatsappfloat').css('bottom'), 10); var tawkChatHeight = parseInt($('iframe[title="chat widget"]').eq(0).css('bottom'), 10); $('#product-page .add-section').after(''); if ($('#sticky-atc .inner .right-col .add-2-cart').length < 1) { $('#sticky-atc .inner .right-col').html($('#product-page .add-section').html()); } if ($('#sticky-atc .inner .left-col h1.title').length < 1) { $('#sticky-atc .inner .left-col .title').html($('#product-page .detail-title h1.title > span').html()); } $(document).on('change', '#product-page .add-section .qty-regulator [name="quantity"]', function () { if ($('#product-page #sticky-atc .qty-regulator [name="quantity"]').length && $('#product-page #sticky-atc .qty-regulator [name="quantity"]').val() != $('#product-page .add-section .qty-regulator [name="quantity"]').val()) { $('#product-page #sticky-atc .qty-regulator [name="quantity"]').val($('#product-page #sticky-atc .qty-regulator [name="quantity"]').val()); }; }); } $(window).on('resize scroll', function () { if ($('#product-page .add-section .add-2-cart').length) { $('#product-page .add-section .add-2-cart').each(function () { if ($(this).isInViewport()) { $('#sticky-atc .inner .right-col').html(''); // Move Tawk && Whatsapp var stickyATCHeight = $('#sticky-atc').height(); if (typeof whatsAppFloatInitialHeight != 'undefined' && $('a.whatsappfloat').hasClass('initialpos') == false) { $('a.whatsappfloat').css('bottom', '20px').css('transition', 'bottom .25s linear').removeClass('positioned').addClass('initialpos'); } if ($('iframe[title="chat widget"]').length > 0 && $('iframe[title="chat widget"]').hasClass('initialpos') == false) { $('iframe[title="chat widget"]').eq(0).css('bottom', '0px').css('transition', 'bottom .25s linear').removeClass('positioned').addClass('initialpos'); } $('#sticky-atc').slideUp(); } else { if ($('#sticky-atc .inner').length) { if ($('#sticky-atc .inner .right-col .add-2-cart').length < 1) { $('#sticky-atc .inner .right-col').html($('#product-page .add-section').html()); } // Move Tawk && Whatsapp var stickyATCHeight = $('#sticky-atc').height(); if (typeof whatsAppFloatInitialHeight != 'undefined' && whatsAppFloatInitialHeight && $('a.whatsappfloat').hasClass('positioned') == false) { $('a.whatsappfloat').css('bottom', whatsAppFloatInitialHeight + stickyATCHeight - 10).css('transition', 'bottom .25s linear').addClass('positioned').removeClass('initialpos'); } if ($('iframe[title="chat widget"]').length > 0 && $('iframe[title="chat widget"]').hasClass('positioned') == false) { $('iframe[title="chat widget"]').eq(0).css('bottom', stickyATCHeight + 15).css('transition', 'bottom .25s linear').addClass('positioned').removeClass('initialpos'); } $('#sticky-atc').slideDown(); } } }); } }); }); /* Ends Daly custom */ /* parameters for the function */ var targetPrice = $('.product-listing .figcaption'); function priceCatch() { if (targetPrice.length) { targetPrice.each(function () { var thisEl = $(this); if ( thisEl.find('.price-full').length) { var ctp = thisEl.find('.price-full'); setTimeout(function () { ctp.prependTo(thisEl.find('.price')); }, 1000); } }); } } priceCatch(); $(window).ajaxComplete(function(){ jQuery('body').addClass('bd-ajx-com'); sectPos = jQuery(window).scrollTop(); lazyIframes(); }); jQuery(document).scroll(function(){ jQuery('body').addClass('bd-scrl'); sectPos = jQuery(window).scrollTop(); lazyIframes(); }); /* Buton Whatsapp */ const wlu = window.location.href; function newWhatsappBtn(){ let msgText = 'Buna! As dori sa fac o comanda pentru:', // %20 phoneNr = '+40748394478', prodTitle = $('.detail-title .title span').text().replace('"','').trim(), prodCode = $('.product-code .code strong').text().trim(), newWhatsBtn = ' Comanda prin WhatsApp'; $(newWhatsBtn).insertAfter('.add-section'); } newWhatsappBtn();