');
} else if (data.header) {
$("div.shop-item:nth-child(12)").after('');
} else {
$('#category-header').html('');
}
initializeShopItems();
}
$currentTimeouts--;
}
});
}, 350);
}
//initialize shop items (sliders, etc.)
function initializeShopItems() {
$('.shop-item.ajax').each(function() {
var $shopItem = $(this);
var $productID = $shopItem.data('id');
var $tagHolder = $shopItem.find('> .product-tag-holder');
var $link = $shopItem.find('h5 a');
var $price = $shopItem.find('p.price');
$shopItem.animate({ opacity:1 }, 600, function() {
$shopItem.removeClass('ajax');
});
if($shopItem.find('.swiper-slide').length>1) {
var $swiper = new Swiper($shopItem.find('.shop-item_swiper')[0], {
loop: true,
navigation: {
nextEl: $shopItem.find('.swiper-button-next')[0],
prevEl: $shopItem.find('.swiper-button-prev')[0],
},
pagination: {
el: $shopItem.find('.swiper-pagination')[0],
type: 'bullets',
clickable: true,
renderBullet: function(index, className) {
var $slide = $shopItem.find('.swiper-slide:eq('+index+')');
var $color = $slide.data('color');
var $light = $slide.data('light');
var $label = $slide.data('bullet-label');
if($light == true) {
className += ' swiper-pagination-bullet-light';
}
return '
';
}
},
a11y: {
prevSlideMessage: 'Previous slide',
nextSlideMessage: 'Next slide',
firstSlideMessage: 'This is the first slide',
lastSlideMessage: 'This is the last slide',
paginationBulletMessage: 'Go to slide {{index}}'
},
on: {
slideChange: function(swiper) {
var $activeSlide = $(swiper.slides[swiper.activeIndex]);
$link.attr('href', $activeSlide.find('a').attr('href'));
$price.html($activeSlide.find('.price').html());
$tagHolder.html($activeSlide.find('.product-tag-holder').html());
}
}
});
// toggle aria-hidden on mouseover/focusin
$shopItem.on('mouseover focusin', function() {
$shopItem.find('.swiper-button-next, .swiper-button-prev').attr('aria-hidden', false);
});
// toggle aria-hidden on mouseout/focusout
$shopItem.on('mouseout focusout', function() {
$shopItem.find('.swiper-button-next, .swiper-button-prev').attr('aria-hidden', true);
});
} else {
$shopItem.find('.swiper-button-prev, .swiper-button-next').hide();
if($shopItem.find('.swiper-pagination').length) {
var $slide = $shopItem.find('.swiper-slide');
var $color = $slide.data('color');
var $light = $slide.data('light');
var $class = 'swiper-pagination-bullet swiper-pagination-bullet-active';
if($light == true) {
$class += ' swiper-pagination-bullet--light';
}
$shopItem.find('.swiper-pagination').html('
');
}
}
var $activeSlide = $shopItem.find('.swiper-slide:not(.swiper-slide-duplicate)').first();
$link.attr('href', $activeSlide.find('a').attr('href'));
$price.html($activeSlide.find('.price').html());
$tagHolder.html($activeSlide.find('.product-tag-holder').html());
});
}
//url parameter helpers
function url_split(url) {
url=url.split('?', 2);
if(url.length>1) {
var query=url[1].split('&');
query.unshift(url[0]);
return query;
}
return url;
}
function url_join(url) {
var res=url.shift();
if(url.length>0) {
res+='?';
res+=url.shift();
while(url.length>0) {
res+='&';
res+=url.shift();
}
}
return res;
}
function add_parameter($parameter, $url) {
if($parameter!='') {
if($url.indexOf('?')!=-1) return $url+'&'+$parameter;
else return $url+'?'+$parameter;
}
}
function remove_parameter($parameter, $url) {
if($parameter!='') {
var matches=[$parameter];
var parts=$parameter.split('=', 2);
matches.push(encodeURIComponent(parts[0])+'='+parts[1]);
matches.push(parts[0]+'='+encodeURIComponent(parts[1]));
matches.push(encodeURIComponent(parts[0])+'='+encodeURIComponent(parts[1]));
$url=url_split($url);
for(var i=1; i= 0; i -= 1) {
param = params_arr[i].split("=")[0];
if(param === $key) {
params_arr.splice(i, 1);
}
}
rtn = rtn + "?" + params_arr.join("&");
}
return rtn;
}
//popstate
window.onpopstate = function(e) {
if($previousState) load_products();
$previousState = e.state;
$scrollTrigger = true;
history.replaceState(true, '', window.location);
};
});
Sort by:
Newest Price (low-high) Price (high-low) Popularity
');