(function($){ "use strict"; jQuery(document).on('mouseup',function (e){ var container=jQuery('.header-search .product-categories'); var container_cart; if(!container.is(e.target)&&container.has(e.target).length===0&&!jQuery('.cate-toggler').is(e.target)){ if(jQuery('.header-search .product-categories').hasClass('open')){ jQuery('.header-search .product-categories').removeClass('open'); }} container=jQuery('.atc-notice-wrapper'); if(!container.is(e.target)&&container.has(e.target).length===0){ jQuery('.atc-notice-wrapper').fadeOut(); } container=jQuery('.searchform'); if(!container.is(e.target)&&container.has(e.target).length===0){ jQuery(".ws").removeClass("show"); }}); var heightbody=jQuery('.page-wrapper').height(); if(heightbody < jQuery(window).height()){ jQuery('body').addClass('small-body'); }else{ jQuery('body').removeClass('small-body'); } var oldCateMenuH, realMMH, realCateMenuH; jQuery(document).ready(function(){ jQuery('.close-sidebar').on("click",function(){ jQuery('.sidebar-mobile').toggleClass('show'); }); jQuery('.open-sidebar').on("click",function(){ jQuery('.sidebar-mobile').toggleClass('show'); }); jQuery(document).on('added_to_wishlist removed_from_wishlist', function(){ var counter=jQuery('.wishlist-count'); $.ajax({ url: yith_wcwl_l10n.ajax_url, data: { action: 'yith_wcwl_update_wishlist_count' }, dataType: 'json', success: function(data){ counter.html(data.count); }, beforeSend: function(){ counter.block(); }, complete: function(){ counter.unblock(); }}); }); jQuery (".progressBar").each(function(){ var product_id=jQuery (this).data('pid'); var product_qty=jQuery (this).data('pqty'); var product_sold=jQuery (this).data('psold'); var total=product_sold + product_qty; jQuery('.progressBar-'+product_id).find('div').width(Math.floor(product_qty/total*100) + "%"); }); if(makali_show_catmenu_home){ jQuery('.categories-menu-wrapper').addClass('show-catemenu'); }else{ jQuery('.categories-menu-wrapper').removeClass('show-catemenu'); } if(jQuery('.categories-menu-container').length > 0||jQuery('.categories-menu > ul').length > 0){ jQuery('.morelesscate').css('display', 'none'); jQuery('.morelesscate').addClass('alwayshide'); } if(jQuery('#categories ul.mega_main_menu_ul > li.menu-item').length < makali_menu_number){ jQuery('.morelesscate').css('display', 'none'); jQuery('.morelesscate').addClass('alwayshide'); makali_menu_number=jQuery('#mega_main_menu ul.mega_main_menu_ul > li.menu-item').length ; } oldCateMenuH=makali_menu_number * jQuery('#categories ul.mega_main_menu_ul > li.menu-item').outerHeight() + jQuery('.morelesscate').outerHeight(); realMMH=jQuery('#categories ul.mega_main_menu_ul > li.menu-item').length * jQuery('#categories ul.mega_main_menu_ul > li.menu-item').outerHeight(); realCateMenuH=realMMH + jQuery('.morelesscate').outerHeight() ; if(jQuery('#categories').css('display')=='block'){ jQuery('.categories-menu').addClass('show'); jQuery('.catemenu-inner').css('height', oldCateMenuH); }else{ jQuery('.categories-menu').removeClass('show'); jQuery('.catemenu-inner').css('height', realCateMenuH); } if(jQuery('.categories-menu-container').length > 0||jQuery('.categories-menu > ul').length > 0){ oldCateMenuH=jQuery('ul.categories-menu > li.menu-item').length * jQuery('ul.categories-menu > li.menu-item').outerHeight(); jQuery('.catemenu-inner').css('height', oldCateMenuH); } jQuery('.catemenu-toggler').on('click', function(){ if(jQuery('.categories-menu > ul').css('display')=='none'){ jQuery('.categories-menu > ul').css('display', 'block'); }else{ jQuery('.categories-menu > ul').css('display', 'none'); } if(jQuery('.categories-menu-container').css('display')=='none'){ jQuery('.categories-menu').addClass('show'); jQuery('.catemenu-inner').css({'height': 'auto'}); jQuery('.categories-menu-container').css('display', 'block'); }else{ jQuery('.categories-menu').removeClass('show'); jQuery('.catemenu-inner').css({'height': 0}); jQuery('.categories-menu-container').css('display', 'none'); } if(jQuery('#categories').css('display')=='none'){ jQuery('.categories-menu').addClass('show'); jQuery('#categories').css('display', 'block'); jQuery('#categories').animate({'opacity': 1}, 100, function(){ if(!jQuery('.morelesscate').hasClass('alwayshide')){ jQuery('.morelesscate').fadeIn('fast'); } oldCateMenuH=makali_menu_number * jQuery('#categories ul.mega_main_menu_ul > li.menu-item').outerHeight() + jQuery('.morelesscate').outerHeight(); realMMH=jQuery('#categories ul.mega_main_menu_ul > li.menu-item').length * jQuery('#categories ul.mega_main_menu_ul > li').outerHeight(); realCateMenuH=realMMH + jQuery('.morelesscate').outerHeight(); if(jQuery('.morecate').css('display')=='none'){ jQuery('.catemenu-inner').css({'height': realCateMenuH}); }else{ jQuery('.catemenu-inner').css({'height': oldCateMenuH}); }}); }else{ jQuery('#categories').animate({'opacity': 0}, 200, function(){ jQuery('.categories-menu').removeClass('show'); jQuery('#categories').css('display', 'none'); jQuery('.morelesscate').css('display', 'none'); oldCateMenuH=makali_menu_number * jQuery('#categories ul.mega_main_menu_ul > li.menu-item').outerHeight(); realMMH=jQuery('#categories ul.mega_main_menu_ul > li.menu-item').length * jQuery('#categories ul.mega_main_menu_ul > li').outerHeight(); realCateMenuH=realMMH + jQuery('.morelesscate').outerHeight(); jQuery('.catemenu-inner').css({'height': oldCateMenuH}); }); }}); var catemidx=1; jQuery('#categories ul.mega_main_menu_ul > li').each(function(){ if(catemidx > makali_menu_number&&jQuery('.morecate').css('display')!='none'){ jQuery(this).css('display', 'none'); jQuery(this).addClass('mhide'); } catemidx++; }); jQuery('.morelesscate').on('click', function(){ oldCateMenuH=makali_menu_number * jQuery('#categories ul.mega_main_menu_ul > li.menu-item').outerHeight() + jQuery('.morelesscate').outerHeight(); realMMH=jQuery('#categories ul.mega_main_menu_ul > li.menu-item').length * jQuery('#categories ul.mega_main_menu_ul > li').outerHeight(); realCateMenuH=realMMH + jQuery('.morelesscate').outerHeight(); if(jQuery('.morecate').css('display')=='none'){ jQuery('.catemenu-inner').animate({'height': oldCateMenuH}, function(){ jQuery('.morecate').css('display', 'block'); jQuery('.lesscate').css('display', 'none'); jQuery('.mhide').css('display', 'none'); }); }else{ jQuery('.mhide').css('display', 'block'); jQuery('.catemenu-inner').animate({'height': realCateMenuH}, function(){ jQuery('.morecate').css('display', 'none'); jQuery('.lesscate').css('display', 'block'); }); }}); jQuery(".wsearchsubmit").on('click',function(){ if(jQuery(".ws").width()==0){ if(jQuery(".ws").hasClass("show")){ jQuery(".ws").removeClass("show"); }else{ jQuery(".ws").addClass("show"); return false; }} }); jQuery('.search-dropdown').on('mouseover', function(){ jQuery(this).find('.searchform').stop(true, true).slideDown(); }); jQuery('.search-dropdown').on('mouseleave', function(){ jQuery(this).find('.searchform').stop(true, true).slideUp(); }); jQuery('.wpml-ls .wpml-ls-sub-menu li').parent().addClass('hasChild'); var item_procat='.product-categories > li'; jQuery('.product-categories .current-cat-parent').addClass('hidesub'); jQuery(item_procat).on('click', function(){ if(jQuery(this).hasClass('hidesub')){ jQuery(this).removeClass('hidesub').find('.children').slideUp(); }else{ jQuery(item_procat).removeClass('hidesub').find('.children').slideUp(); jQuery(this).addClass('hidesub').find('.children').slideDown(); }}); jQuery('.vmenu-toggler').on('mouseover', function(){ jQuery(this).find('.vmenu-content').stop(true, true).slideDown(); }); jQuery('.vmenu-toggler').on('mouseleave', function(){ jQuery(this).find('.vmenu-content').stop(true, true).slideUp(); }); jQuery('.horizontal-menu .nav-menu > ul').superfish({ delay: 100, speed: 'fast' }); jQuery('.primary-menu-container ul.nav-menu').superfish({ delay: 100, speed: 'fast' }); var mobileMenuWrapper=jQuery('.mobile-menu-container'); mobileMenuWrapper.find('.menu-item-has-children').each(function(){ var linkItem=jQuery(this).find('a').first(); linkItem.after(''); }); var totalMenuLevelFirst=jQuery('.mobile-menu-container .nav-menu > li').length; var mobileMenuH=totalMenuLevelFirst*40 + 10; jQuery('.mbmenu-toggler').on('click', function(){ var mobileMenuHi=jQuery('div.nav-menu > ul').outerHeight(); if(jQuery('.mobile-menu div.nav-menu').outerHeight()==0){ jQuery('.mobile-menu div.nav-menu').animate({'height': mobileMenuHi}, 'fast'); }else{ jQuery('.mobile-menu div.nav-menu').animate({'height': 0}, 'fast'); } if(mobileMenuWrapper.hasClass('open')){ mobileMenuWrapper.removeClass('open'); mobileMenuWrapper.animate({'height': 0}, 'fast'); }else{ mobileMenuWrapper.addClass('open'); mobileMenuWrapper.animate({'height': mobileMenuH}, 'fast'); }}); jQuery('.mobile-menu-container li.menu-item-has-children').each(function(){ jQuery(this).css({'height': 40, 'overflow': 'hidden'}); }); jQuery('.mobile-menu-container li.menu-item-has-children').each(function(){ var parentLi=jQuery(this); var dropdownUl=parentLi.find('ul.sub-menu').first(); parentLi.find('.fa').first().on('click', function(){ parentLi.parents('li.menu-item-has-children').css('height', 'auto'); mobileMenuWrapper.css({'height': 'auto'}); var dropdownUlheight=dropdownUl.outerHeight() + 40; if(parentLi.hasClass('opensubmenu')){ parentLi.removeClass('opensubmenu'); parentLi.animate({'height': 40}, 'fast', function(){ mobileMenuH=mobileMenuWrapper.outerHeight(); }); parentLi.find('.fa').first().removeClass('fa-angle-down'); parentLi.find('.fa').first().addClass(' fa-angle-right'); }else{ parentLi.addClass('opensubmenu'); parentLi.animate({'height': dropdownUlheight}, 'fast', function(){ mobileMenuH=mobileMenuWrapper.outerHeight(); }); parentLi.find('.fa').first().addClass('fa-angle-down'); parentLi.find('.fa').first().removeClass(' fa-angle-right'); }}); }); if(jQuery(window).width() > 1024){ jQuery('.widget_shopping_cart').each(function(){ jQuery(this).on('mouseover', function(){ var mCartHeight=jQuery(this).find('.mini_cart_inner').outerHeight(); var cCartHeight=jQuery(this).find('.mini_cart_content').outerHeight(); if(cCartHeight < mCartHeight){ jQuery(this).find('.mini_cart_content').stop(true, false).animate({'height': mCartHeight}); }}); jQuery(this).on('mouseleave', function(){ jQuery(this).find('.mini_cart_content').animate({'height':'0'}); }); }); } jQuery('.widget_shopping_cart').each(function(){ jQuery(this).on('click', function(event){ if(jQuery(window).width() < 1025){ var closed=false; var mCartHeight=jQuery(this).find('.mini_cart_inner').outerHeight(); var mCartToggler=jQuery(this).find('.cart-toggler'); if(jQuery(this).find('.mini_cart_content').height()==0){ closed=true; } if(mCartToggler.is(event.target)||mCartToggler.has(event.target).length!=0||mCartToggler.is(event.target)){ event.preventDefault(); if(closed){ jQuery(this).find('.mini_cart_content').animate({'height': mCartHeight}); closed=false; }else{ jQuery(this).find('.mini_cart_content').animate({'height':'0'}, function(){ closed=true; }); }} }}); }); var cateToggler=jQuery('.cate-toggler'); jQuery('.header-search .product-categories').prepend('
  • '+cateToggler.html()+'
  • '); cateToggler.on('click', function(){ jQuery('.header-search .product-categories').toggleClass('open'); }); var searchCat=''; var currentCat=RoadgetParameterByName('product_cat', jQuery('.header-search .product-categories .current-cat a').attr('href')); var currentCatName=jQuery('.current-cat a').html(); if(currentCatName!=''){ cateToggler.html(currentCatName); jQuery('.wsearchsubmit').on('click', function(){ if(searchCat==''){ jQuery('.searchform').attr('action', jQuery('.header-search .product-categories .current-cat a').attr('href')); }}); } if(currentCat!=''){ if(!(jQuery('#product_cat').length > 0)){ jQuery('.searchform').append(''); } jQuery('#product_cat').val(currentCat); } jQuery('.header-search .product-categories a').each(function(){ jQuery(this).on('click', function(event){ event.preventDefault(); jQuery('.header-search .product-categories a.active').removeClass('active'); jQuery(this).addClass('active'); jQuery('.header-search .product-categories').removeClass('open'); jQuery('.searchform').attr('action', jQuery(this).attr('href')); cateToggler.html(jQuery(this).html()); searchCat=jQuery(this).attr('href'); if(!(jQuery('#product_cat').length > 0)&&(RoadgetParameterByName('product_cat', jQuery(this).attr('href'))!='')){ jQuery('.searchform').append(''); } jQuery('#product_cat').val(RoadgetParameterByName('product_cat', jQuery(this).attr('href'))); }); }); jQuery('body').append('
    '); jQuery('.atc-notice-wrapper .close').on('click', function(){ jQuery('.atc-notice-wrapper').fadeOut(); jQuery('.atc-notice').html(''); }); var ajaxPId=0; jQuery('body').on('adding_to_cart', function(event, button, data){ ajaxPId=button.attr('data-product_id'); }); jQuery('body').on('added_to_cart', function(event, fragments, cart_hash){ jQuery.post(ajaxurl, { 'action': 'get_productinfo', 'data': {'pid': ajaxPId}}, function(response){ jQuery('.atc-notice').html(response); jQuery('.atc-notice-wrapper').fadeIn(); } ); }); jQuery('a.yith_magnifier_thumbnail').on('click', function(){ jQuery('a.yith_magnifier_thumbnail').removeClass('active'); jQuery(this).addClass('active'); }); jQuery('.toolbar .orderby').chosen({disable_search: true, width: "auto"}); jQuery('#lang_choice_1').chosen({disable_search: true, width: "auto"}); jQuery('.image-slider').each(function(){ var items_1201up=parseInt(jQuery(this).attr('data-1201up')); var items_993_1200=parseInt(jQuery(this).attr('data-993-1200')); var items_769_992=parseInt(jQuery(this).attr('data-769-992')); var items_641_768=parseInt(jQuery(this).attr('data-641-768')); var items_481_640=parseInt(jQuery(this).attr('data-481-640')); var items_0_480=parseInt(jQuery(this).attr('data-0-480')); var navigation=true; if(parseInt(jQuery(this).attr('data-navigation'))!==1){navigation=false} ; var pagination=false; if(parseInt(jQuery(this).attr('data-pagination'))==1){pagination=true} ; var item_margin=parseInt(jQuery(this).attr('data-margin')); var auto=false; if(parseInt(jQuery(this).attr('data-auto'))==1){auto=true} ; var loop=false; if(parseInt(jQuery(this).attr('data-loop'))==1){loop=true} ; var speed=parseInt(jQuery(this).attr('data-speed')); jQuery(this).addClass('owl-carousel owl-theme').owlCarousel({ nav:navigation, dots:pagination, margin:item_margin, loop:loop, autoplay:auto, smartSpeed:speed, addClassActive:false, responsiveClass: true, responsive:{ 0: { items: items_0_480, }, 481: { items: items_481_640, }, 641: { items: items_641_768, }, 769: { items: items_769_992, }, 993: { items: items_993_1200, }, 1201: { items: items_1201up, }, }}); }); jQuery('.brands-carousel').each(function(){ var items_1201up=parseInt(jQuery(this).attr('data-1201up')); var items_993_1200=parseInt(jQuery(this).attr('data-993-1200')); var items_769_992=parseInt(jQuery(this).attr('data-769-992')); var items_641_768=parseInt(jQuery(this).attr('data-641-768')); var items_481_640=parseInt(jQuery(this).attr('data-481-640')); var items_0_480=parseInt(jQuery(this).attr('data-0-480')); var navigation=true; if(parseInt(jQuery(this).attr('data-navigation'))!==1){navigation=false} ; var pagination=false; if(parseInt(jQuery(this).attr('data-pagination'))==1){pagination=true} ; var item_margin=parseInt(jQuery(this).attr('data-margin')); var auto=false; if(parseInt(jQuery(this).attr('data-auto'))==1){auto=true} ; var loop=false; if(parseInt(jQuery(this).attr('data-loop'))==1){loop=true} ; var speed=parseInt(jQuery(this).attr('data-speed')); jQuery(this).addClass('owl-carousel owl-theme').owlCarousel({ nav:navigation, dots:pagination, margin:item_margin, loop:loop, autoplay:auto, smartSpeed:speed, addClassActive:false, responsiveClass: true, responsive:{ 0: { items: items_0_480, }, 481: { items: items_481_640, }, 641: { items: items_641_768, }, 769: { items: items_769_992, }, 993: { items: items_993_1200, }, 1201: { items: items_1201up, }, }}); }); jQuery('.inner-brands .brands-carousel').each(function(){ var plantmore_brandcols=jQuery(this).attr('data-col'); jQuery(this).slick({ infinite: true, slidesToShow: 5, slidesToScroll: plantmore_brandscrollnumber, speed: plantmore_brandanimate, easing: 'linear', dots: true, arrows: false, autoplay: plantmore_brandscroll, autoplaySpeed: plantmore_brandpause, responsive: [ { breakpoint: 1199, settings: { slidesToShow: 4, }}, { breakpoint: 767, settings: { slidesToShow: 3, }}, { breakpoint: 479, settings: { slidesToShow: 1, }} ] }); }); jQuery('.countdown').each(function(){ var countTime=jQuery(this).attr('data-time'); jQuery(this).countdown(countTime, function(event){ jQuery(this).html('
    '+''+event.strftime('%D')+''+'Days
    '+'
    '+''+event.strftime('%H')+''+'Hours
    '+'
    '+''+event.strftime('%M')+''+'Mins
    '+'
    '+''+event.strftime('%S')+''+'Secs
    ' ); }); }); jQuery('.countbox.hastime').each(function(){ var countTime=jQuery(this).attr('data-time'); jQuery(this).countdown(countTime, function(event){ jQuery(this).html('
    '+''+event.strftime('%D')+''+'Days
    '+'
    '+''+event.strftime('%H')+''+'Hours
    '+'
    '+''+event.strftime('%M')+''+'Mins
    '+'
    '+''+event.strftime('%S')+''+'Secs
    ' ); }); }); jQuery('.posts-carousel.roadthemes-slider').each(function(){ var items_1201up=parseInt(jQuery(this).attr('data-1201up')); var items_993_1200=parseInt(jQuery(this).attr('data-993-1200')); var items_769_992=parseInt(jQuery(this).attr('data-769-992')); var items_641_768=parseInt(jQuery(this).attr('data-641-768')); var items_481_640=parseInt(jQuery(this).attr('data-481-640')); var items_0_480=parseInt(jQuery(this).attr('data-0-480')); var navigation=true; if(parseInt(jQuery(this).attr('data-navigation'))!==1){navigation=false} ; var pagination=false; if(parseInt(jQuery(this).attr('data-pagination'))==1){pagination=true} ; var item_margin=parseInt(jQuery(this).attr('data-margin')); var auto=false; if(parseInt(jQuery(this).attr('data-auto'))==1){auto=true} ; var loop=false; if(parseInt(jQuery(this).attr('data-loop'))==1){loop=true} ; var speed=parseInt(jQuery(this).attr('data-speed')); jQuery(this).addClass('owl-carousel owl-theme').owlCarousel({ nav:navigation, dots:pagination, margin:item_margin, loop:loop, autoplay:auto, smartSpeed:speed, addClassActive:false, responsiveClass: true, responsive:{ 0: { items: items_0_480, }, 481: { items: items_481_640, }, 641: { items: items_641_768, }, 769: { items: items_769_992, }, 993: { items: items_993_1200, }, 1201: { items: items_1201up, }, }}); }); jQuery('.cross-sells .shop-products').addClass('owl-carousel').owlCarousel({ items:4, margin:20, nav:true, dots:false, responsive:{ 0: { items: 1, }, 360: { items: 2, }, 641: { items: 3, }, 769: { items: 3, }, 993: { items: 4, }, 1201: { items: 4, }} }); jQuery('.zoom_in_marker').on('click', function(){ jQuery.fancybox({ href: jQuery('.woocommerce-main-image').attr('href'), openEffect:'elastic', closeEffect:'elastic' }); }); jQuery('.upsells .shop-products').addClass('owl-carousel').owlCarousel({ items:4, margin:20, nav:true, dots:false, responsive:{ 0: { items: 1, }, 360: { items: 2, }, 641: { items: 3, }, 769: { items: 3, }, 993: { items: 4, }, 1201: { items: 4, }} }); jQuery('.related .shop-products').addClass('owl-carousel').owlCarousel({ items:4, margin:20, nav:true, dots:false, responsive:{ 0: { items: 1, }, 360: { items: 2, }, 641: { items: 3, }, 769: { items: 3, }, 993: { items: 4, }, 1201: { items: 4, }} }); jQuery('.products-carousel.shop-products').each(function(){ var total=jQuery(this).find('.owl-stage .owl-item.active').length; jQuery(this).find('.owl-stage .owl-item.active').each(function(index){ if(index===0){ jQuery(this).addClass('firstActiveItem'); } if(index===total - 1){ jQuery(this).addClass('lastActiveItem'); }}); jQuery(this).on('translated.owl.carousel', function(event){ jQuery(this).find('.owl-stage .owl-item').removeClass('firstActiveItem lastActiveItem'); jQuery(this).find('.owl-stage .owl-item.active').each(function(index){ if(index===0){ jQuery(this).addClass('firstActiveItem'); } if(index===total - 1){ jQuery(this).addClass('lastActiveItem'); }}); }); }); jQuery('.view-mode').each(function(){ jQuery(this).find('.grid').on('click', function(event){ event.preventDefault(); jQuery('.view-mode').find('.grid').addClass('active'); jQuery('.view-mode').find('.list').removeClass('active'); jQuery('#archive-product .shop-products').removeClass('list-view'); jQuery('#archive-product .shop-products').addClass('grid-view'); jQuery('#archive-product .list-col4').removeClass('col-xs-12 col-sm-4'); jQuery('#archive-product .list-col8').removeClass('col-xs-12 col-sm-8'); }); jQuery(this).find('.list').on('click', function(event){ event.preventDefault(); jQuery('.view-mode').find('.list').addClass('active'); jQuery('.view-mode').find('.grid').removeClass('active'); jQuery('#archive-product .shop-products').addClass('list-view'); jQuery('#archive-product .shop-products').removeClass('grid-view'); jQuery('#archive-product .list-col4').addClass('col-xs-12 col-sm-4'); jQuery('#archive-product .list-col8').addClass('col-xs-12 col-sm-8'); }); }); jQuery('.yith-wcwl-add-to-wishlist a').each(function(){ makalitip(jQuery(this), 'html'); }); var compareText=jQuery('.single-product-info .compare').html(); jQuery('.single-product-info .compare').html(''+compareText+''); jQuery('.comparetip').each(function(){ makalitip(jQuery(this), 'html'); }); jQuery('.compare-button a').each(function(){ makalitip(jQuery(this), 'html'); }); jQuery('.add_to_cart_inline a').each(function(){ }); jQuery('.quickviewbtn .quickview').each(function(){ makalitip(jQuery(this), 'html'); }); jQuery('.sharefriend a').each(function(){ makalitip(jQuery(this), 'html'); }); jQuery('.social-icons a').each(function(){ makalitip(jQuery(this), 'title'); }); jQuery('.product-wrapper').each(function(){ jQuery(this).on('mouseover click', function(){ jQuery(this).addClass('hover'); }); jQuery(this).on('mouseleave', function(){ jQuery(this).removeClass('hover'); }); }); jQuery('body').append('
    '); var arrIdx=0; var quickviewArr=Array(); var nextArrID=0; var prevArrID=0; jQuery('.quickview').each(function(){ var quickviewLink=jQuery(this); var productID=quickviewLink.attr('data-quick-id'); if(quickviewArr.indexOf(productID)==-1){ quickviewArr[arrIdx]=productID; arrIdx++; } quickviewLink.on('click', function(event){ event.preventDefault(); prevArrID=quickviewArr[quickviewArr.indexOf(productID) - 1]; nextArrID=quickviewArr[quickviewArr.indexOf(productID) + 1]; jQuery('.qvprev').attr('data-quick-id', prevArrID); jQuery('.qvnext').attr('data-quick-id', nextArrID); showQuickView(productID, quickviewArr); }); }); jQuery('.qvprev').on('click', function(){ showQuickView(jQuery(this).attr('data-quick-id'), quickviewArr); }); jQuery('.qvnext').on('click', function(){ showQuickView(jQuery(this).attr('data-quick-id'), quickviewArr); }); jQuery('.closeqv').on('click', function(){ hideQuickView(); }); jQuery(".fancybox").fancybox({ openEffect:'elastic', closeEffect:'fade', beforeShow: function (){ if(this.title){ this.title +='
    '; this.title +='Tweet '; this.title +='
    '; }}, afterShow: function(){ twttr.widgets.load(); }, helpers: { title:{ type:'inside' }, overlay:{ showEarly:false }} }); jQuery(".prfancybox").fancybox({ openEffect:'fade', closeEffect:'elastic', nextEffect:'fade', prevEffect:'fade', helpers: { title:{ type:'inside' }, overlay:{ showEarly:false }, buttons:{}, thumbs:{ width:100, height:100 }} }); jQuery('.counter-number span').counterUp({ delay: 10, time: 1000 }); jQuery('#back-top').on('click', function(){ jQuery("html, body").animate({ scrollTop: 0 }, "slow"); }); jQuery('.landing-link a').each(function(){ var menulinkID=jQuery(this).attr('href'); if(jQuery(menulinkID).length > 0){ var targetOffset=jQuery(menulinkID).offset().top; jQuery(this).on('click', function(event){ event.preventDefault(); jQuery("html, body").animate({ scrollTop: targetOffset }, "slow"); }); }}); if(makali_sticky_header==true&&jQuery('.header-sticky').length > 0){ var headerSpaceH=jQuery('.header-sticky').height(); jQuery('.header-sticky').after('
    '); }}); var currentP=0; var stickyOffset=0; if(makali_sticky_header==true&&jQuery('.header-sticky').length > 0){ stickyOffset=jQuery('.header-sticky').offset().top; stickyOffset +=jQuery('.header-sticky').outerHeight(); } jQuery(window).scroll(function(){ var headerH=jQuery('.header-container').height(); var scrollP=jQuery(window).scrollTop(); var headerAdb=jQuery('#wpadminbar').height(); if(jQuery(window).width() <=600){ if(scrollP!=currentP){ if(scrollP >=headerAdb){ jQuery('.admin-bar .sidebar-mobile').addClass('under600'); }else{ jQuery('.admin-bar .sidebar-mobile').removeClass('under600'); } currentP=jQuery(window).scrollTop(); }} if(jQuery(window).width() > 300){ if(scrollP!=currentP){ if(scrollP >=headerH){ jQuery('#back-top').addClass('show'); }else{ jQuery('#back-top').removeClass('show'); } if(makali_sticky_header==true&&jQuery('.header-sticky').length > 0){ if(scrollP >=stickyOffset){ jQuery('#back-top').addClass('show'); jQuery('.header-sticky').addClass('ontop show'); jQuery('.headerSpace').addClass('show'); jQuery('.logo-scroll').show(); jQuery('.hide-scroll').hide(); } if(scrollP==0||scrollP < stickyOffset){ jQuery('#back-top').removeClass('show'); jQuery('.header-sticky').removeClass('ontop show'); jQuery('.headerSpace').removeClass('show'); jQuery('.hide-scroll').show(); jQuery('.logo-scroll').hide(); }} currentP=jQuery(window).scrollTop(); }} }); jQuery(window).load(function(){ jQuery('.list_projects #projects_list').shuffle({ itemSelector: '.project' }); jQuery('.filter-options .btn').on('click', function(){ var filterBtn=jQuery(this), isActive=filterBtn.hasClass('active'), group=isActive ? 'all':filterBtn.data('group'); if(!isActive){ jQuery('.filter-options .active').removeClass('active'); } filterBtn.toggleClass('active'); jQuery('.list_projects #projects_list').shuffle('shuffle', group); }); }); })(jQuery); "use strict"; function RoadgetParameterByName(name, string){ name=name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex=new RegExp("[\\?&]" + name + "=([^&#]*)"), results=regex.exec(string); return results===null ? "":decodeURIComponent(results[1].replace(/\+/g, " ")); } function roadtabCarousel(element, itemnumbers1, itemnumbers2, itemnumbers3, itemnumbers4, itemnumbers5){ jQuery(element).addClass('owl-carousel').owlCarousel({ items:itemnumbers1, margin:30, nav:true, dots:false, responsive:{ 0:{ items: itemnumbers5, }, 480:{ items: itemnumbers4, }, 768:{ items: itemnumbers3, }, 992:{ items: itemnumbers2, }, 1200:{ items: itemnumbers1, }, }}); } function roadMiniCartRemove(url, itemid){ jQuery('.mini_cart_content').addClass('loading'); jQuery('.cart-form').addClass('loading'); jQuery.get(url, function(data,status){ if(status=='success'){ jQuery.post(ajaxurl, { 'action': 'get_cartinfo' }, function(response){ var cartinfo=response.split("|"); var itemAmount=cartinfo[0]; var cartTotal=cartinfo[1]; var orderTotal=cartinfo[2]; jQuery('.cart-quantity').html(itemAmount); jQuery('.cart-total .amount').html(cartTotal); jQuery('.total .amount').html(cartTotal); jQuery('.cart-subtotal .amount').html(cartTotal); jQuery('.order-total .amount').html(orderTotal); } ); jQuery('#mcitem-' + itemid).animate({'height': '0', 'margin-bottom': '0', 'padding-bottom': '0', 'padding-top': '0'}); setTimeout(function(){ jQuery('#mcitem-' + itemid).remove(); jQuery('#lcitem-' + itemid).remove(); var mCartHeight=jQuery('.mini_cart_inner').outerHeight(); jQuery('.mini_cart_content').animate({'height': mCartHeight}); }, 1000); jQuery('.mini_cart_content').removeClass('loading'); jQuery('.cart-form').removeClass('loading'); }}); } function makalitip(element, content){ if(content=='html'){ var tipText=element.html(); }else{ var tipText=element.attr('title'); } element.on('mouseover', function(){ if(jQuery('.makalitip').length==0){ element.before(''); var tipWidth=jQuery('.makalitip').outerWidth(); var tipPush=-(tipWidth/2 - element.outerWidth()/2); jQuery('.makalitip').css('margin-left', tipPush); jQuery('.makalitip').fadeIn(); }}); element.on('mouseleave', function(){ jQuery('.makalitip').fadeOut(); jQuery('.makalitip').remove(); }); } function showQuickView(productID, quickviewArr){ prevArrID=quickviewArr[quickviewArr.indexOf(productID) - 1]; nextArrID=quickviewArr[quickviewArr.indexOf(productID) + 1]; jQuery('.qvprev').attr('data-quick-id', prevArrID); jQuery('.qvnext').attr('data-quick-id', nextArrID); jQuery('body').addClass('quickview'); window.setTimeout(function(){ jQuery('.quickview-wrapper').addClass('open'); jQuery('.qvloading').fadeIn(); jQuery.post(ajaxurl, { 'action': 'product_quickview', 'data': productID }, function(response){ jQuery('#quickview-content').html(response); jQuery('.qvloading').fadeOut(); jQuery('.variations_form').wc_variation_form(); jQuery('.variations_form .variations select').change(); jQuery('.quick-thumbnails').addClass('owl-carousel').owlCarousel({ items: 4, margin: 10, nav:false, dots:true, }); jQuery('.quick-thumbnails a').each(function(){ var quickThumb=jQuery(this); var quickImgSrc=quickThumb.attr('href'); quickThumb.on('click', function(event){ event.preventDefault(); jQuery('.main-image').find('img').attr('src', quickImgSrc); }); }); jQuery('.woocommerce-review-link').on('click', function(event){ event.preventDefault(); var reviewLink=jQuery('.see-all').attr('href'); window.location.href=reviewLink + '#reviews'; }); } ); }, 300); } function hideQuickView(){ jQuery('.quickview-wrapper').removeClass('open'); window.setTimeout(function(){ jQuery('body').removeClass('quickview'); }, 500); } function clickToOpenMenu(){ jQuery('.btn-menu-header button').toggleClass('close'); if(jQuery('.header-container .main-menu-wrapper:visible').length){ jQuery('.header-container .main-menu-wrapper').hide(); }else{ jQuery('.header-container .main-menu-wrapper').show(); };}; (function($){ jQuery(document).ready(function(){ mmm_reversal_z_index(); mmm_sticky_menu(); mmm_fullwidth_menu(); mmm_keep_open(); mmm_height_of_tabs_dropdown(); mmm_pushing_content(); mmm_mobile_double_tap_to_go(); mmm_mobile_toggle_menu(); mmm_smooth_scroll_to_anchor(); mmm_accessibility_actions(); jQuery(window).on('resize orientationchange', function(){ mmm_sticky_menu(); mmm_fullwidth_menu(); mmm_height_of_tabs_dropdown(); mmm_pushing_content(); mmm_smooth_scroll_to_anchor(); }); function mmm_reversal_z_index (){ var z_index=1000; function_selector='.mega_main_menu'; jQuery(function_selector).unbind(); jQuery(function_selector).each(function(index,element){ z_index=z_index - 10; jQuery(element).css({ 'z-index':z_index }); }); } function mmm_mobile_toggle_menu (){ function_selector='.mobile_toggle'; jQuery(function_selector).unbind(); jQuery('.mobile_menu_active').removeClass('mobile_menu_active'); jQuery(function_selector).on('click', function(){ if(jQuery(this).parent().hasClass('mobile_menu_active')){ jQuery(this).parent().removeClass('mobile_menu_active'); jQuery(this).parent().parent().removeClass('mobile_menu_active'); jQuery('.mega_main_menu .keep_open').removeClass('keep_open'); }else{ jQuery(this).parent().addClass('mobile_menu_active'); jQuery(this).parent().parent().addClass('mobile_menu_active'); }}); } function mmm_mobile_double_tap_to_go (){ function_selector='.mega_main_menu li:has(.mega_dropdown) > .item_link, .mega_main_menu li:has(.post_details) > .processed_image'; jQuery(function_selector).unbind(); if(/iphone|ipad|ipod|android|webos|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())){ var clicked_item=false; jQuery(function_selector).on('click', function(index){ if(clicked_item!=this){ index.preventDefault(); if(jQuery(this).parent().parent().parent().hasClass('keep_open')){ }else{ jQuery('.mega_main_menu .keep_open').removeClass('keep_open'); } jQuery(this).parent().addClass('keep_open'); clicked_item=this; }}); }} function mmm_sticky_menu (){ function_selector='.mega_main_menu > .menu_holder'; jQuery(function_selector).unbind(); jQuery(function_selector).each(function(index,element){ var stickyoffset=[]; var menu_inner_width=[]; var menu_inner=[]; var style_attr=[]; menu_inner[ index ]=jQuery(element).find('.menu_inner'); stickyoffset[ index ]=jQuery(element).data('stickyoffset') * 1; if(jQuery(element).hasClass('coercive_styles-enable')){ rules_priority=' !important'; }else{ rules_priority=''; } if(jQuery(element).attr('data-sticky')=='1'&&stickyoffset[ index ]==0){ menu_inner_width[ index ]=menu_inner[ index ].parents('.mega_main_menu').width(); menu_inner[ index ].attr('style' , 'width:' + menu_inner_width[ index ] + 'px;'); jQuery(element).addClass('sticky_container'); }else{ jQuery(window).on('scroll', function(){ if(jQuery(element).attr('data-sticky')=='1'){ scrollpath=jQuery(window).scrollTop(); if(scrollpath > stickyoffset[ index ]){ menu_inner_width[ index ]=menu_inner[ index ].parents('.mega_main_menu').width(); jQuery(element).find('.menu_inner').attr('style' , 'width:' + menu_inner_width[ index ] + 'px;'); jQuery(element).find('.mmm_fullwidth_container').attr('style' , 'left: 0px' + rules_priority + ';'); if(!jQuery(element).hasClass('sticky_container')){ jQuery(element).addClass('sticky_container'); }}else{ mmm_fullwidth_menu(); jQuery(element).removeClass('sticky_container'); style_attr[ index ]=jQuery(menu_inner[ index ]).attr('style'); if(typeof style_attr[ index ]!=='undefined'&&style_attr[ index ]!==false){ menu_inner[ index ].removeAttr('style'); }} }else{ jQuery(element).removeClass('sticky_container'); }}); }}); } function mmm_fullwidth_menu (){ function_selector='.mega_main_menu.direction-horizontal.fullwidth-enable'; jQuery(function_selector).unbind(); body_width=jQuery('body').width(); jQuery(function_selector).each(function(index, element){ offset_left=jQuery(element).offset().left; if(jQuery(element).hasClass('coercive_styles-enable')){ rules_priority=' !important'; }else{ rules_priority=''; } jQuery(element).find('.mmm_fullwidth_container').attr('style' , 'width:' + body_width + 'px' + rules_priority + ';left: -' + offset_left + 'px' + rules_priority + ';right:auto' + rules_priority + ';'); }); } function mmm_height_of_tabs_dropdown (){ function_selector='.mega_main_menu .tabs_dropdown > .mega_dropdown > li'; jQuery(function_selector).unbind(); jQuery('.mega_main_menu .tabs_dropdown').on('hover mouseleave mouseenter', function(event){ jQuery('.dropdowns_trigger-hover .keep_open').removeClass('keep_open'); my_el=jQuery(this).find('.mega_dropdown > li').first(); jQuery(my_el).parent().css({ "min-height": jQuery(my_el).find('.mega_dropdown').outerHeight(true) }); jQuery(my_el).find(' > .mega_dropdown').css({ "min-height": jQuery(my_el).closest('.mega_dropdown').outerHeight(true) }); jQuery(my_el).addClass('keep_open'); }); jQuery('.dropdowns_trigger-hover' + function_selector).on('hover mouseenter transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd', function(event){ jQuery('.dropdowns_trigger-hover .keep_open').removeClass('keep_open'); jQuery(this).parent().css({ "min-height": jQuery(this).find('.mega_dropdown').outerHeight(true) }); jQuery(this).find(' > .mega_dropdown').css({ "min-height": jQuery(this).closest('.mega_dropdown').outerHeight(true) }); jQuery(this).addClass('keep_open'); }); jQuery('.dropdowns_trigger-hover' + function_selector).on('mouseleave ', function(event){ jQuery(this).parent().css({ "min-height": '0px' }); jQuery(this).find(' > .mega_dropdown').css({ "min-height": '0px' }); }); jQuery('.dropdowns_trigger-click' + function_selector).on('click', function(){ jQuery(this).parent().parent().find('.mega_dropdown').css({ "min-height": '0px' }); jQuery(this).parent().css({ "min-height": jQuery(this).find(' > .mega_dropdown').outerHeight(true) }); }); } function mmm_pushing_content (){ function_selector='.mega_main_menu.direction-horizontal.pushing_content-enable'; jQuery(function_selector).unbind(); jQuery(function_selector).each(function(index, element){ if(jQuery(element).hasClass('coercive_styles-enable')){ rules_priority=' !important'; }else{ rules_priority=''; } menu_holder_height=jQuery(element).find('.menu_holder').outerHeight(true); click_item=false; if(jQuery(element).hasClass('dropdowns_trigger-click')){ dropdowns_trigger='click'; if(jQuery('.mega_main_menu .nav_logo.mobile_menu_active').length){ }else{ jQuery('body').on(dropdowns_trigger, function(body_el){ menu_item_class=jQuery(body_el.target).closest('.menu-item').attr('class'); if(typeof jQuery(body_el.target).parents('.menu-item').attr('class')!='undefined'){ jQuery(element).css({ height: menu_holder_height + jQuery(this).find('.mega_main_menu_ul > li.keep_open > .mega_dropdown').outerHeight(true) + rules_priority }); if(click_item==menu_item_class){ jQuery(element).css({ height: menu_holder_height }); click_item=false; }else{ click_item=jQuery(body_el.target).closest('.menu-item').attr('class'); }}else{ jQuery(element).css({ height: menu_holder_height }); click_item=false; }}); }}else{ dropdowns_trigger='hover mouseleave'; if(jQuery('.mega_main_menu .nav_logo.mobile_menu_active').length){ }else{ jQuery(element).find('li').on(dropdowns_trigger, function(body_el){ jQuery(element).delay(200).css({ height: menu_holder_height + jQuery(element).find('.mega_main_menu_ul > li:hover > .mega_dropdown').outerHeight(true) + rules_priority }); }); }} }); } function mmm_smooth_scroll_to_anchor (){ function_selector='.mega_main_menu a[href*="#"]:not([href="#"])'; jQuery(function_selector).on('click', function(){ if(location.pathname.replace(/^\//,'')==this.pathname.replace(/^\//,'')&&location.hostname==this.hostname){ var target=jQuery(this.hash); target=target.length ? target:jQuery('[name=' + this.hash.slice(1) +'], [id=' + this.hash.slice(1) +']'); if(target.length){ jQuery('.mega_main_menu .current-menu-item').removeClass('current-menu-item'); jQuery(this).parent().addClass('current-menu-item'); jQuery('html,body').animate({ scrollTop: target.offset().top - 90 }, 600); jQuery('.mega_main_menu .mobile_menu_active').removeClass('mobile_menu_active'); }} }); }; function mmm_keep_open (){ /* function_selector='.mega_main_menu .menu-item *'; jQuery(function_selector).unbind(); jQuery(function_selector).on('focus', function(index){ jQuery(this).parents('.menu-item, .post_item').addClass('keep_open'); }) jQuery(function_selector).on('hover', function(index){ jQuery(this).parents('.menu-item, .post_item').removeClass('keep_open'); }) jQuery(function_selector).on('blur', function(index){ jQuery(this).parents('.menu-item, .post_item').removeClass('keep_open'); }) */ click_item_2=false; /* if(true!=/iphone|ipad|ipod|android|webos|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())){ } */ jQuery('body').on('click', function(body_el){ menu_item_class=jQuery(body_el.target).closest('.menu-item').attr('class'); if(( click_item_2!=menu_item_class)&&(typeof jQuery(body_el.target).closest('.mega_main_menu.dropdowns_trigger-click .menu-item:has(.mega_dropdown)').attr('class')!='undefined')){ if(jQuery(body_el.target).closest('.menu-item').find('.mega_dropdown').length){ body_el.preventDefault(); } jQuery('.mega_main_menu .keep_open').removeClass('keep_open'); jQuery(body_el.target).parents('.menu-item').addClass('keep_open'); click_item_2=jQuery(body_el.target).closest('.menu-item').attr('class'); }else if(jQuery(body_el.target).is('.mega_main_menu .mega_dropdown form *:focus')){ jQuery('.mega_main_menu .keep_open').removeClass('keep_open'); jQuery(body_el.target).parents('.menu-item').addClass('keep_open'); }else if(( click_item_2==menu_item_class)){ jQuery(body_el.target).closest('.menu-item').removeClass('keep_open'); click_item_2=false; }else{ jQuery('.menu-item').removeClass('keep_open'); click_item_2=false; }}); } function mmm_accessibility_actions (){ window.onkeydown=function(onkeydown_event){ if(jQuery(onkeydown_event.target).hasClass('item_link')){ if(onkeydown_event.keyCode==32){ onkeydown_event.preventDefault(); check_condition=jQuery(onkeydown_event.target).parent('.menu-item').hasClass('keep_open'); jQuery('.mega_main_menu .keep_open').removeClass('keep_open'); jQuery('.mega_main_menu [aria-expanded="true"]').attr('aria-expanded', false); jQuery(onkeydown_event.target).parents('.menu-item').addClass('keep_open'); jQuery(onkeydown_event.target).attr('aria-expanded', true); jQuery(onkeydown_event.target).siblings(".mega_dropdown").attr('aria-expanded', true); if(check_condition){ jQuery(onkeydown_event.target).parent('.menu-item').removeClass('keep_open'); jQuery(onkeydown_event.target).attr('aria-expanded', false); jQuery(onkeydown_event.target).siblings(".mega_dropdown").attr('aria-expanded', false); }} }else{ jQuery('.mega_main_menu .keep_open').removeClass('keep_open'); jQuery('.mega_main_menu [aria-expanded="true"]').attr('aria-expanded', false); }};}}); })(jQuery);