'),
current_slide=0;
$items.eq(current_slide).addClass('current');
$items_hidden.removeClass('hidden').hide();
if($items.length > 1){
for(var i=0; i<$items.length; i++){
$nav.append('
'+(i+1)+'');
}
$inner.append($nav);
}
var goToSlide=function(index){
if(current_slide!=index){
index=index % $items.length;
var $to_hide=$items.filter('.current'),
$to_show=$items.eq(index);
$to_show.show();
$to_hide.hide();
var next_height=$to_show.outerHeight(true) + $nav.outerHeight();
$to_hide.show();
$to_show.hide();
$nav.find('a').removeClass('active').eq(index).addClass('active');
var $th_thumbnail=$to_hide.find('.testimonial-thumbnail'),
$th_blockquote=$to_hide.find('.testimonial-blockquote p'),
$th_cite=$to_hide.find('.testimonial-blockquote cite');
var $ts_thumbnail=$to_show.find('.testimonial-thumbnail'),
$ts_blockquote=$to_show.find('.testimonial-blockquote p'),
$ts_cite=$to_show.find('.testimonial-blockquote cite');
TweenLite.to($th_thumbnail, .10, {css: {autoAlpha: 0}});
TweenLite.to($th_cite, .25, {css: {autoAlpha: 0, top: 20}});
TweenLite.to($th_blockquote, .25, {css: {autoAlpha: 0}, delay: .1, onComplete: function(){
$th_thumbnail.attr('style', '');
$th_blockquote.attr('style', '');
$th_cite.attr('style', '');
$to_hide.attr('style', '').removeClass('current').hide();
$to_show.show().addClass('current');
TweenLite.set($to_show, {css: {autoAlpha: 0}});
TweenLite.set($ts_cite, {css: {autoAlpha: 0, top: 20}});
TweenLite.to($ts_cite, .25, {css: {autoAlpha: 1, top: 0}, onComplete: function(){
$ts_cite.attr('style', '');
}});
TweenLite.to($to_show, .25, {css: {autoAlpha: 1}, onComplete: function(){
current_slide=index;
}});
}});
TweenLite.to($inner, .35, {css: {height: next_height}, onComplete: function(){
$inner.attr('style', '');
}});
}};
$nav.on('click', 'a', function(ev){
ev.preventDefault();
goToSlide(parseInt($(this).data('index'), 10));
});
if(autoswitch > 0){
var hover_tm=0,
setupAutoSwitcher=function(on){
window.clearTimeout(hover_tm);
if(on){
hover_tm=setTimeout(function(){
goToSlide(current_slide+1);
setupAutoSwitcher(1);
}, autoswitch * 1000);
}};
$testimonials
.on('mouseover', function(){
setupAutoSwitcher();
}).
on('mouseleave', function(){
setupAutoSwitcher(true);
});
setupAutoSwitcher(true);
}});
var replaceWooCommerceQuantityButtons=function(){
$(".quantity").each(function(i, el){
var $quantity=$(el),
$button=$quantity.find('.qty');
if($quantity.hasClass('buttons_added'))
return;
$quantity.addClass('buttons_added');
$button.before('
');
$button.after('
');
});
};
replaceWooCommerceQuantityButtons();
$("body").on('click', 'input[type="button"].plusminus', function(){
var $this=$(this),
$quantity=$this.prev(),
add=1;
if($this.hasClass('minus')){
$quantity=$this.next();
add=-1;
}
var newVal=parseInt($quantity.val(), 10) + add;
if(newVal < 0)
newVal=0;
$quantity.val(newVal);
});
if(publicVars.$cartCounter.hasClass('cart-counter-ajax')){
$.post(ajaxurl, {action: 'lab_wc_add_to_cart'}, function(resp){
updateCartNumber(resp);
}, 'json');
}
var $magnifier=$(".product-images.magnify-active");
if($magnifier.length){
$magnifier.on('mouseenter', function(){
$magnifier.addClass('hovered');
if(typeof $magnifier.data('owlCarousel')!='undefined'){
$magnifier.data('owlCarousel').stop();
}});
$magnifier.find(".owl-item a, > a").each(function(i, el){
var $a=$(el),
$img=$a.find('img');
$img.attr({
'data-imagezoom': $a.attr('href')
});
});
}
$(".post-content .gallery").each(function(i, el){
var $gallery=$(el),
$items=$gallery.find('a'),
has_gallery_lb=false;
$items.each(function(j, item){
var $item=$(item);
if($item.attr('href').match(/(jpg|jpeg|png|gif)$/i)){
$item.attr('data-lightbox-gallery', 'post-gallery-' + (i+1));
has_gallery_lb=true;
}});
if(has_gallery_lb){
$items.nivoLightbox({
effect: 'fade',
theme: 'default',
});
}});
$(".yith-add-to-wishlist").each(function(i, el){
var $this=$(el),
url=$this.data('listid'),
id=url.match(/add_to_wishlist=([0-9]+)/);
if(id.length)
id=id[1];
$this.on('click', function(ev){
ev.preventDefault();
$this.parent().addClass('is-loading');
$.post(url, {}, function(resp, textStatus, xhr){
$this.parent().removeClass('is-loading');
if(resp.match(/true\#\#/)||resp.match(/exists\#\#/)||resp.match(/DOCTYPE html/)){
$this.parent().addClass('wishlisted');
$("#product-"+id+" .yith-wcwl-wishlistexistsbrowse").removeClass('hide').hide().slideDown();
}});
});
});
$(".mobile-menu.sticky-mobile").each(function(i, el){
var $stickyMenu=$(el),
$spacer=$(''),
height=0;;
$stickyMenu.addClass('is-fixed-mobile');
height=$stickyMenu.outerHeight();
if(publicVars.$body.hasClass('transparent-header')==false){
$stickyMenu.before($spacer);
$spacer.height(height);
}});
$('.products.products-masonry').each(function(i, el){
var $this=$(el);
$this.removeClass('hidden ');
if($this.prev().is('.shop-loading-products')){
$this.prev().remove();
}
var $categories=$this.find('> .product-category');
if($categories.length){
var $categoriesContainer=$('
');
$this.before($categoriesContainer);
$categoriesContainer.append($categories);
$categories.addClass('category-col-item');
$categoriesContainer.isotope({
itemSelector: '.category-col-item',
layoutMode: $this.data('layoutMode')
});
}
$this.isotope({
itemSelector: '.item-column',
layoutMode: $this.data('layoutMode')
});
$this.find('img').each(function(j, el2){
var img=new Image(),
img_url=$(this).attr('src');
if(img_url){
img.src=img_url;
img.onload=function(){
$this.isotope('layout');
}}
});
/*
return;
var $this=$(el),
imagesList=[];
if($this.parent().is('.lab-vc-products-carousel')){
return;
}
$this.find('img').each(function(j, el2){
var $img=$(el2);
imagesList.push($img.attr('src'));
});
imagesLoaded(imagesList, function(){
$this.removeClass('hidden ');
if($this.prev().is('.shop-loading-products')){
$this.prev().remove();
}
$this.not('.product-category').isotope({
itemSelector: '.item-column',
layoutMode: $this.data('layoutMode')
});
});
*/
});
$(document).on('found_variation', function(ev, variation){
if(variation.image_src.length){
$('.product-thumbnails .first img').attr('src', variation.image_src)
}});
var $variation_thumb=$('.product-thumbnails a:first-child');
if($variation_thumb.length){
$variation_thumb.data({
main: $variation_thumb.attr('href'),
thumb: $variation_thumb.find('img').attr('src')
});
$(document).on('reset_image', function(ev){
$variation_thumb.find('img').attr('src', $variation_thumb.data('thumb'));
$('.woocommerce-main-image').first().find('img').attr('src', $variation_thumb.data('main'));
});
}});
function setupStickyMenu(){
var headerType=1;
if(publicVars.$header.hasClass('header-type-2')){
headerType=2;
}
else
if(publicVars.$header.hasClass('header-type-3')){
headerType=3;
}
else
if(publicVars.$header.hasClass('header-type-4')){
headerType=4;
}
var $watcherElement=publicVars.$header.find('.header-menu');
if(headerType===2){
$watcherElement=publicVars.$header.find('.full-menu');
}
else
if(headerType===3||headerType===4){
$watcherElement=publicVars.$header.find('> .container');
}
var watcher=window.scrollMonitor.create($watcherElement.get(0), {top: publicVars.$body.hasClass('admin-bar') ? 32:0}),
$spacer=null,
headerHeight=publicVars.$header.outerHeight(),
minWidth=768;
publicVars.$header.before('');
$spacer=publicVars.$header.prev();
$spacer.height(headerHeight);
watcher.lock();
watcher.partiallyExitViewport(function(){
if(minWidth > $(window).width()){
return;
}
publicVars.$header.addClass('sticked');
$spacer.removeClass('hidden');
if(publicVars.$headerTopMenu.length){
publicVars.$headerTopMenu.addClass('hidden');
}
if(headerType===2){
publicVars.$header.find('.header-menu').addClass('hidden');
publicVars.$header.find('.full-menu .logo').addClass('visible').hide().fadeTo(200, 1);
}});
watcher.fullyEnterViewport(function(){
if(minWidth > $(window).width()){
return;
}
publicVars.$header.removeClass('sticked');
$spacer.addClass('hidden');
if(publicVars.$headerTopMenu.length){
publicVars.$headerTopMenu.removeClass('hidden');
}
if(headerType===2){
publicVars.$header.find('.header-menu').removeClass('hidden');
publicVars.$header.find('.full-menu .logo').removeClass('visible').attr('style', '');
}});
}
function setupMobileMenu(){
var subMenuVisibleClass='sub-visible',
expandOrCollapseDelay=0.2;
publicVars.$mobileMenu.find('.mobile-menu li:has(> ul)').each(function(i, el){
var $li=$(el),
$a=$li.children('a'),
$sub=$li.children('ul');
$a.append('');
var $sub_i=$a.find('.sub-menu-indicator');
$sub_i.on('click', function(ev){
ev.preventDefault();
if(! $li.hasClass(subMenuVisibleClass)){
$li.addClass(subMenuVisibleClass);
var subHeight=$sub.outerHeight();
$sub.height(0);
TweenMax.to($sub, expandOrCollapseDelay, {css: {height: subHeight}, onComplete: function(){
$sub.attr('style', '');
}});
}else{
TweenMax.to($sub, expandOrCollapseDelay, {css: {height: 0}, onComplete: function(){
$sub.attr('style', '');
$li.removeClass(subMenuVisibleClass);
$sub.find("."+subMenuVisibleClass).removeClass(subMenuVisibleClass).children('ul').attr('style', '');
}});
}});
});
publicVars.$mobileMenu.find('.toggle-menu').on('click', function(ev){
ev.preventDefault();
publicVars.$mobileMenu.find('.mobile-menu').toggle();
publicVars.$mobileMenu.find('.search-site').toggle();
publicVars.$mobileMenu.find('.cart-info').toggle();
publicVars.$mobileMenu.find('.site-header').toggle();
publicVars.$mobileMenu.find('.cart-info a').unbind();
});
publicVars.$mobileMenu.find('.site-header .right-align').removeClass('right-align');
}})(jQuery, window);
function _rtl(){
return jQuery("html").is('[dir="rtl"]') ? 'rtl':'ltr';
}
function _is_rtl(){
return _rtl()=='rtl';
}
function is_touch_device(){
return 'ontouchstart' in window
|| 'onmsgesturechange' in window;
};