$(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... */ /* GOMK-43185 */ if($(window).width() > 768){ $('.detail-recomended').appendTo('.product-bottom .row'); } /* ORDINE PRODUCATORI */ function ordineproducatori(){ if (screen.width > 768) { $('.filter-group:not(.mm-nav-filter) .filter.box .title-h p.title:contains(Producatori)').parent().parent().find('.option-group').addClass('prodorder'); } else { $('.filter-group.mm-nav-filter .filter.box .title-h p.title:contains(Producatori)').parent().parent().find('.option-group').addClass('prodorder'); } $('.prodorder').find('li').sort(function (a, b) { return $(a).find('span').text().replace(/\(|\)/g, "") - $(b).find('span').text().replace(/\(|\)/g, ""); }).appendTo('.prodorder'); $('.prodorder li').each(function(){ $(this).prependTo('.prodorder'); $(this).addClass('filter-hide'); }); $('.prodorder li').slice(0,5).removeClass('filter-hide'); } $(document).ready(function(){ ordineproducatori(); }); $('.filter-trg').click(function(){ ordineproducatori(); }); /* END ORDINE PRODUCATORI */ const wwloc = window.location.href; function recentProductsFix(){ if($('.__recentProducts .bundle-it img[data-src]').length){ $('.__recentProducts .bundle-it img[data-src]').each(function(){ if(!$(this).hasClass('bundle-fx')){ var getHisDataSrc = $(this).attr('data-src'); $(this).attr('src',getHisDataSrc).addClass('bundle-fx'); } }); } }; function productDetailsPage(){ if($('#product-page').length){ if( $('#product-page .detail-prod-attr .detail-product-atributes .short-description').length && $('#product-page .detail-prod-attr .product-code').length ){ $('#product-page .detail-product-atributes .short-description').parent().addClass('new-dec-atributes').insertAfter('#product-page .detail-prod-attr .product-code'); }else if( $('#product-page .detail-prod-attr .detail-product-atributes .short-description').length && $('#product-page .detail-prod-attr .add-section').length ){ $('#product-page .detail-product-atributes .short-description').parent().addClass('new-dec-atributes').insertAfter('#product-page .detail-prod-attr .add-section'); } if($('#product-page .new-dec-atributes .short-description').length){ var hetTheHeight = $('#product-page .new-dec-atributes .short-description').height(); if( hetTheHeight >= 40 && $('#product-page .new-dec-atributes .rd-more').length < 1 ){ $('#product-page .new-dec-atributes .short-description').addClass('rd-more'); if($('.rd-more .btn-rd-more').length < 1){ $('Vezi mai mult').appendTo('#product-page .new-dec-atributes'); } } } } } productDetailsPage(); $(document).on('click','.btn-rd-more',function(){ $(this).toggleClass('open'); $(this).parent().find('.short-description').toggleClass('open'); if($(this).parent().find('.short-description').hasClass('open')){ $(this).text('Vezi mai putin'); }else{ $(this).text('Vezi mai mult'); } }); $(document).ready(function(){ $('.detail-tabs .resp-tab-item').click(function(){ displayTab(); }); var tabVideo = $('.detail-tabs .video-tab'); var tabDescription = $('.detail-tabs .description-tab'); function displayTab(){ if(tabDescription.hasClass('resp-tab-content-active')){ tabVideo.css('display', 'block'); } } displayTab(); }); $( document ).ready(function() { function addProductsData(products) { if(products == undefined) { return false; } $.each(products, function(i, v){ if(v.data != undefined && v.data['listingBundle'] != undefined) { if($('.-g-product-box-'+v.id+' .box-holder').length && !($('.-g-custom-product-list-bundle-'+v.id).length)){ $('.-g-product-box-'+v.id+' .box-holder').append(v.data['listingBundle']); } } }); } $(document).on('Gomag/Product/Data/Loaded', function(event, products){ if(products != undefined && products.products != undefined){ addProductsData(products.products); $('.slide-item-custom-bundle').owlCarousel({ items:3, navigation:!0, pagination:!1, itemsCustom : [[0,1],[479,2],[768,3],[979,3],[1199,3]] }); } }); $('.product-listing .product-box').each(function(){ var price = $(this).find('.price').clone(); $(this).find('.bottom-side-box').prepend(price); }); var txtlength = 200; var moretext = "Vezi mai mult"; var lesstext = "Vezi mai putin"; $('.product-listing .product-box').each(function(){ if ($(this).find('.-g-productlist-description').length){ var content = $(this).find('.-g-short-description-list').text(); //console.log(content.length) if (content.length > txtlength){ $(this).find('.-g-short-description-list').addClass('textCrop'); $(this).find('.-g-productlist-description').append('
    Vezi mai multe
    '); } } }); $('.view-more').click(function(){ if($(this).hasClass("less")) { $(this).removeClass("less"); $(this).html(lesstext); } else { $(this).addClass("less"); $(this).html(moretext); } $(this).prev().toggleClass('textCrop'); return false; }); }); $(document).ajaxComplete(function(){ recentProductsFix(); productDetailsPage(); });