(function($){ //$(window).on("load",function(){ // $('body').addClass('loaded'); //}); $(document).ready(function(){ $('ul.product-categories li.cat-parent').each(function(){ var p = $(this), btn = $('',{'class':'showsubmenu icon-plus7', text : '' }).click(function(){ if(p.hasClass('parent-showsub')){ menu.slideUp(300,function(){ p.removeClass('parent-showsub'); }); }else{ menu.slideDown(300,function(){ p.addClass('parent-showsub'); }); }; }), menu = p.children('ul') ; p.prepend(btn) // append : trong - duoi, prepend : trong - tren, after : duoi, before : tren }); jQuery('ul.product-categories ul li.current-cat').parent().parent().addClass('parent-showsub'); /////////// tooltip var $topSearch= $('#topSearch'); $('.btn-search-mb').click(function(){ if($topSearch.hasClass('show-top-search')){ $topSearch.removeClass('show-top-search'); }else{ $topSearch.addClass('show-top-search'); } }); $('[data-toggle="tooltip"]').tooltip() ////////// Add Class $('.epl-stickers-wrapper .under-offer_').each(function(){$(this).parent().addClass('epl-stickers-under-offer');}); var child = $('.woocommerce.widget_products .product_list_widget').children(); for(var i=0; i< child.length; i++){ var item = $(child[i]); if(item.length >0){ item.attr('data-id',i+1); } } $('.item-btn .compare-button a').each(function(){ $(this).addClass('btn icon-params').html(''); }); $('.item-btn .yith-wcwl-add-to-wishlist a').each(function(){ $(this).addClass('btn icon-heart-o').html(''); }); ////////// Move if ($('#jv-nav-right .jv-nav-right-content').length) { $('ul.singlemenu').appendTo("#jv-nav-right .jv-nav-right-content"); }; if ($('#block-breadcrumb .container').length) { $('#page-shop-sidebar ul#breadcrumb').prependTo("#block-breadcrumb .container"); } if ($('#block-breadcrumb .container').length) { $('#maincontent h1.entry-title').prependTo("#block-breadcrumb .container"); } // Remove text $(".prev.page-numbers").addClass(' icon-arrow-left10').html(""); $(".next.page-numbers").addClass(' icon-arrow-right10').html(""); // BTN Touch var $body= $('body'); $('.btn-menu-mobile').click(function(){ if($body.hasClass('show-menu-mobile')){ $body.removeClass('show-menu-mobile'); }else{ $body.addClass('show-menu-mobile'); } }); // bpopup $('body').delegate('[data-rel=bpopup]','click',function(){ $($(this).attr('href')).bPopup({closeClass:'bpopup-close'}); return false; }); $("#header").headroom({ // vertical offset in px before element is first unpinned offset : 210, // or you can specify tolerance individually for up/down scroll tolerance : { up : 0, down : 0 }, classes : { // when element is initialised // initial : "", // when scrolling up pinned : "scroll-up", // when scrolling down unpinned : "scroll-down", } }); var $container = $('.blogMasonry'); $container.imagesLoaded(function(){ $container.masonry({ itemSelector: '.itemMasonry' }); }); }); })(jQuery); jQuery( function( $ ) { var b = $( 'body' ); if( !b.hasClass( 'post-type-archive' ) ){ return false; } var a = b.attr( 'class' ).match( /post-type-archive-[a-zA-Z0-9]+/ ); if( !a ) { return false; } a = a.shift().replace( /post-type-archive-/, '' ); $( '.epl-search-form [id="post_type"]' ).each( function() { var e = $( this ) ,ev = e.val() ; if( ev == a ) { $( '[data-tab="' + e.closest( '.epl-search-form' ).addClass( 'active' ).attr( 'id' ) + '"]' ).addClass( 'active' ); } } ); } ); (function(t){ t.extend(t.fn, { syncOwl: function (e) { e = t.extend({ main: { items: 1 }, sub: { items: 4, afterInit: function (e) { e.data({ items: e.find('.owl-item').each(function (e) { t(this).data({ owlItem: e }); }) }).data('items').first().addClass('active'); } } }, e), e.main.afterAction = function (t) { var e = this.currentItem, a = t.data('sub'); if( !a || !a.length ) { return; } a.data('items').removeClass('active').eq(e).addClass('active'), a.trigger('center', e); }, e.sub.afterInit = function (e) { e.data({ items: e.find('.owl-item').each(function (e) { t(this).data({ owlItem: e }); }) }).data('items').first().addClass('active'); }; var a = e.main.selector, i = e.sub.selector; return this.each(function () { var n = t(this), o = n.find(a), s = n.find(i); s.owlCarousel(e.sub).delegate('.owl-item', 'click', function (e) { e.preventDefault(), o.trigger('owl.goTo', t(this).data('owlItem')); }).on({ center: function (e, a) { var i = t(this), n = i.data('owlCarousel').owl.visibleItems, o = t.inArray(a, n) > - 1 ? 1 : 0; o ? a === n[n.length - 1] ? i.trigger('owl.goTo', n[1]) : a === n[0] && i.trigger('owl.goTo', a - 1) : a > n[n.length - 1] ? i.trigger('owl.goTo', a - n.length + 2) : (a - 1 === - 1 && (a = 0), i.trigger('owl.goTo', a)); } }), o.data({ sub: s }).owlCarousel(e.main); }); } }); })(jQuery); jQuery(function (t) { t('.inner-item').syncOwl({ main: { selector: '.imgMainProduct', transitionStyle:'goDown', singleItem : true, items: 1, autoPlay : false, stopOnHover:true }, sub: { selector: '.imgsubproduct', items: 2, itemsTablet: [768,2], itemsMobile: [479,2], navigation : true, navigationText : ["",""] } }); t('.shopImages').syncOwl({ main: { selector: '.imgMainProduct', transitionStyle:'fade', singleItem : true, items: 1 }, sub: { selector: '.imgsubproduct', items: 3, navigation: true, navigationText : ["",""], itemsDesktop :[1199,3], itemsDesktopSmall:[979,2], itemsTablet: [768,2], itemsMobile: [479,2] } }); });