// TECHNIQ ====== $(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 + */"500px"}); } 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 JS... */ /* atelierulfamiliei.ro JS (FEB 2023) */ const defUrl = window.location.href; const demoCondition_demoUrlParam = '#demo=true'; function demoCondition(){ if(defUrl.indexOf(demoCondition_demoUrlParam) > -1){ $('body').addClass('demo-gomag'); if($('a[href^="http"]').length){ $('a[href^="http"]').each(function(){ if(!$(this).hasClass('cls-demo-gomag-link')){ if( $(this).attr('href').indexOf(demoCondition_demoUrlParam) < 0 && $(this).attr('href').indexOf('#') < 0 ){ $(this).attr('href',$(this).attr('href')+demoCondition_demoUrlParam); } $(this).addClass('cls-demo-gomag-link'); } }); } } } // demoCondition(); function singlePage(){ if( $('.product-page-holder').length && $('.box-addtocart').length < 1 ){ var addToCart = '
    '; $(addToCart).appendTo('body'); $('body').addClass('body-box-addtocart').attr('id','strongid'); } // for cart button if($('.-g-product-details .add-section .btn-cart').length){ if(!$('.-g-product-details .add-section .btn-cart').hasClass('dom-moved')){ $('.-g-product-details .add-section .btn-cart').addClass('dom-moved').appendTo('.-g-product-details .add-section'); } if($('.box-addtocart .btn-cart.dom-moved').length < 1){ $('.-g-product-details .add-section .btn-cart.dom-moved').clone().appendTo('.box-addtocart'); } } // for wishlist button if( $('.-g-product-details .wish-section .wish-btn').length && $('.-g-product-details .add-section .btn-cart').length ){ if(!$('.-g-product-details .wish-section .wish-btn').hasClass('dom-moved')){ $('.-g-product-details .wish-section .wish-btn').addClass('dom-moved').insertAfter('.-g-product-details .add-section .btn-cart'); } if($('.box-addtocart .wish-btn.dom-moved').length < 1){ $('.-g-product-details .add-section .wish-btn.dom-moved').clone().prependTo('.box-addtocart'); if($('.box-addtocart .wish-btn.dom-moved').length){ $('.box-addtocart .wish-btn.dom-moved').html($('.box-addtocart .wish-btn.dom-moved').html().trim().replace('Adauga la Favorite','Adauga la Favorite')); } } } // for main final price if($('#product-page .detail-prod-attr .detail-price .fPrice').length){ if($('#product-page .detail-prod-attr .detail-price .fPrice .new-html').length < 1){ var htmlTxt = $('#product-page .detail-prod-attr .detail-price .fPrice').html().trim(); if(htmlTxt.indexOf(',') > -1){ htmlTxt = htmlTxt.replace(',',','); htmlTxt = htmlTxt.replace('RON','RON'); htmlTxt = htmlTxt.replace('EUR','EUR'); }else{ htmlTxt = htmlTxt.replace('RON','RON'); htmlTxt = htmlTxt.replace('EUR','EUR'); } var newHtmlTxt = ''+htmlTxt+''; $('#product-page .detail-prod-attr .detail-price .fPrice').addClass('dom-updated').html(newHtmlTxt); } } // for main old price if($('#product-page .detail-prod-attr .detail-price .bPrice').length){ if($('#product-page .detail-prod-attr .detail-price .bPrice .new-html').length < 1){ var htmlTxt = $('#product-page .detail-prod-attr .detail-price .bPrice').html().trim(); if(htmlTxt.indexOf(',') > -1){ htmlTxt = htmlTxt.replace(',',','); htmlTxt = htmlTxt.replace('RON','RON'); htmlTxt = htmlTxt.replace('EUR','EUR'); }else{ htmlTxt = htmlTxt.replace('RON','RON'); htmlTxt = htmlTxt.replace('EUR','EUR'); } var newHtmlTxt = ''+htmlTxt+''; $('#product-page .detail-prod-attr .detail-price .bPrice').addClass('dom-updated').html(newHtmlTxt); } } // for the price move if( $('#product-page .detail-prod-attr .detail-price').length && $('#product-page .-g-product-details .add-section').length ){ if(!$('#product-page .-g-product-details .add-section').hasClass('dom-moved')){ $('#product-page .-g-product-details .add-section').addClass('dom-moved').insertAfter('#product-page .detail-prod-attr .detail-price'); } } // for the stock move if( $('#product-page .detail-prod-attr .detail-product-atributes .stock-status').length && $('#product-page .detail-prod-attr .detail-price').length ){ if(!$('#product-page .detail-prod-attr .detail-product-atributes .stock-status').hasClass('dom-moved')){ $('#product-page .detail-prod-attr .detail-product-atributes .stock-status').addClass('dom-moved').insertAfter('#product-page .detail-prod-attr .detail-price'); } } } singlePage(); function listPages(){ // .product-box .price .text-main // for main new price if($('.box-holder .price .text-main').length){ $('.box-holder .price .text-main').each(function(){ if($(this).find('.new-html').length < 1){ var htmlTxt = $(this).html().trim(); if(htmlTxt.indexOf(',') > -1){ htmlTxt = htmlTxt.replace(',',','); htmlTxt = htmlTxt.replace('RON','RON'); htmlTxt = htmlTxt.replace('EUR','EUR'); }else{ htmlTxt = htmlTxt.replace('RON','RON'); htmlTxt = htmlTxt.replace('EUR','EUR'); } var newHtmlTxt = ''+htmlTxt+''; $(this).addClass('dom-updated').html(newHtmlTxt); } }); } // for main old price if($('.box-holder .price s.price-full').length){ $('.box-holder .price s.price-full').each(function(){ if($(this).find('.new-html').length < 1){ var htmlTxt = $(this).html().trim(); if(htmlTxt.indexOf(',') > -1){ htmlTxt = htmlTxt.replace(',',','); htmlTxt = htmlTxt.replace('RON','RON'); htmlTxt = htmlTxt.replace('EUR','EUR'); }else{ htmlTxt = htmlTxt.replace('RON','RON'); htmlTxt = htmlTxt.replace('EUR','EUR'); } var newHtmlTxt = ''+htmlTxt+''; $(this).addClass('dom-updated').html(newHtmlTxt); } }); } } listPages(); $(document).ajaxStop(function(){ singlePage(); listPages(); }) /* Mutare cod produs */ var scod = document.querySelector(".dataProductId .code"); var tcod = document.querySelector(".-g-product-title"); if( scod && tcod ){ tcod.appendChild(scod); }