$(document).ready(function () {
if ($('.main-header .FH').length){
// FASHION DEPTH ==========
var fullMenu = '';
$('ul.base-menu li.ifDrop').each(function(){
fullMenu = fullMenu + '
';
});
$('.nav-menu.base-menu').addClass('container-h');
$('ul.base-menu li.all-product-button').remove();
$('ul.base-menu').prepend(fullMenu);
$('ul.base-menu li > a > i').removeClass('fa-angle-right');
$('ul.base-menu li > a > i').addClass('fa-angle-down');
$('ul.base-menu ul.drop-list').each(function(){
if(!$(this).parent('div.menu-dd').length){
$('').insertBefore($(this));
}
})
$('div.menu-dd').each(function(){
var image = $(this).next('ul.drop-list').find('li.image').html();
var slider = $(this).next('ul.drop-list').find('li.slider-menu').html();
$(this).next('ul.drop-list').find('li.image').remove();
$(this).next('ul.drop-list').find('li.slider-menu').remove();
var subcat = $(this).next('ul.drop-list').html();
if(subcat != undefined){
var w = $(this).next('ul.drop-list').hasClass('w60') ? 'w60' : 'w100';
$(this).next('ul.drop-list').remove();
$(this).append('');
if ( $(image).length ) {
$(this).append(''+image+'
');
}
if ( $(slider).length ) {
$(this).append('');
}
}
});
// BASE MENU ==========
$('ul.base-menu').show();
};
if ( $('.discount-tape').length){
var hellobar = $('.discount-tape').detach();
$('.main-header #navigation:first').prepend(hellobar);
};
// FASHION MENU ==========
function Menu(){
$('.menu-dd').each(function() {
var $this = $(this);
var Nli = $this.find('li').length;
var Nlink = $this.find('a').length;
var Ncol = Math.ceil(Nlink / 15);
var Mbanner = $this.find('.cat-img').length;
Ncol = Ncol == 0 ? 1 : Ncol;
col = Nli > Ncol ? Ncol : Nli;
col = (col + (Mbanner ? 1 : 0) > 4) ? 4 : col;
$this.addClass('column' + col);
if (Mbanner){$this.addClass('banner');};
if ($this.find('li span > a').length == 0){
$this.addClass('no-sub');
};
if ($this.hasClass('column4')){
$this.parent().addClass('initial-h');
};
});
};
Menu();
$('.main-header .menu-drop').hover(function() {
$('.main-header .menu-drop .menu-dd').removeClass('open');
$(this).children('.menu-dd').stop().addClass('open');
if ( $('.slide-item-menu').length ) {
$('.slide-item-menu').owlCarousel({items:1,navigation:!0,pagination:!1});
// get owl element
var owl = $('.slide-item-menu');
// get owl instance from element
var owlInstance = owl.data('owlCarousel');
// if instance is existing
if(owlInstance != null)
owlInstance.reinit();
};
},function() {
$('.main-header .menu-drop .menu-dd').removeClass('open');
});
//FIXED-HEADER
if($( window ).width() > 1090 && $('.-g-pagetype-homepage').length){
var nav = $('#navigation');
var pos = nav.height();
$(window).scroll(function () {
var fix = ($(this).scrollTop() > pos) ? true : false;
nav.toggleClass("fix-nav", fix);
if(fix){
$('#logo svg .st0').css('fill', '#000');
} else {
$('#logo svg .st0').css('fill', '#fff');
};
});
};
// BF SIDEBAR + MENU STICKY
$.Gomag.bind('Widget/Add/After', function(){
if($('.-g-template-black-friday').length){
$('.main-header').css({'top' : '-' + $('.discount-tape').height() + 'px'});
}
if($( window ).width() > 991 && $('.-g-template-black-friday').length){
$('.landing-h .side-menu.fixed').css({'top' : $('#navigation .main-menu').outerHeight() + 20 + 'px'});
}
});
if($('.main.search-form-box').length){
var logo = $('#logo').detach();
if($('.logo-h .btn').length){
var backToHome = $('.logo-h .btn').detach();
$('.menu-trg').after('');
$('.-g-logo-btn-holder').append(logo, backToHome);
}else{
logo.insertAfter('.menu-trg');
}
$('.cart-header-btn').insertAfter('.search-m');
};
if($('.-g-pagetype-homepage').length){
$('#navigation').addClass('over-top');
};
if($('#contact-page').length){
$('.breadcrumb').hide();
$('#contact-map').insertBefore('#contact-page');
};
//DETAIL
var breadcrumbs = $('.breadcrumbs-default').detach();
$('.detail-title .title').before(breadcrumbs);
var share_section = $('.detail-share').detach();
$('.wish-section:not(.customer-points)').after(share_section);
$('.detail-tabs').insertAfter('.detail-prod-attr');
if($('.extra-offer').length){
$('.extra-offer').insertBefore('.detail-tabs');
}
if($('.extra-offer .slide-item-4').length){
$('.extra-offer .slide-item-4').each(function(){
$(this).data('owlCarousel').destroy();
$(this).owlCarousel({
items: 2,
navigation:true,
pagination:false,
itemsCustom : [[0,2],[450, 2],[600, 3],[700, 4],[991, 2],[1200, 2],[1300, 2]]
});
});
};
if($('.detail-tabs .blog-posts-sld').length){
setTimeout(function(){
$('.detail-tabs .blog-posts-sld').each(function(){
$(this).data('owlCarousel').destroy();
$(this).owlCarousel({
items: 2,
navigation:true,
pagination:false,
itemsCustom : [[0,1],[450, 2],[600, 2],[700, 3],[991, 2],[1200, 2],[1300, 2]]
});
});
}, 150);
};
$('.thumb-h').addClass('horizontal').insertAfter('.vertical-slide-img');
$('.thumb-sld').slick('unslick');
$('.thumb-sld').slick({
vertical: false,
slidesToShow: 5,
slidesToScroll: 1,
asNavFor: '.prod-lg-sld',
dots: false,
infinite: false,
focusOnSelect: true
});
$('.wish-section .addToWishlist').insertAfter('.add-section .add2cart').addClass('btn').html('').show();
var wishPP = $('.wish-section .wishlist-pp').detach();
$('.wish-section .addToWishlist').after(wishPP);
function reinitEasyResponsiveTabs() {
$('#resp-tab').easyResponsiveTabs({
type: 'default', //Types: default, vertical, accordion
width: 'auto', //auto or any width like 600px
fit: true, // 100% fit in a container
tabidentify: 'tab-grup', // The tab groups identifier
activate: function(event) { // Callback function if tab is switched
var $tab = $(this);
var $info = $('#nested-tabInfo');
var $name = $('span', $info);
$name.text($tab.text());
$info.show();
}
});
};
// After AJAX Complete
$.Gomag.bind('Product/Details/After/Ajax/Load/Complete', function(response){
$('.detail-title .title').before(breadcrumbs);
$('.thumb-h').addClass('horizontal').insertAfter('.vertical-slide-img');
$('.thumb-sld').slick('unslick');
$('.thumb-sld').slick({
vertical: false,
slidesToShow: 5,
slidesToScroll: 1,
asNavFor: '.prod-lg-sld',
dots: false,
infinite: false,
focusOnSelect: true
});
$('.wish-section').after(share_section);
$('.wish-section .addToWishlist').insertAfter('.add-section .add2cart').addClass('btn').html('').show();
$('.addToWishlist').after(wishPP);
if($('.extra-offer').length){
$('.extra-offer').insertBefore('.detail-tabs');
$('.extra-offer .slide-item-4').each(function(){
$(this).data('owlCarousel').destroy();
$(this).owlCarousel({
items: 2,
navigation:true,
pagination:false,
itemsCustom : [[0,2],[450, 2],[600, 3],[700, 4],[991, 2],[1200, 2],[1300, 2]]
});
});
};
});
});