");
quickview.find(".product-description").text(productdes);
if (product.compare_at_price > product.price) {
quickview.find(".compare-price").html(Shopify.formatMoney(product.compare_at_price_max, window.money_format)).show();
quickview.find(".price").addClass("on-sale")
}
else {
quickview.find(".compare-price").html("");
quickview.find(".price").removeClass("on-sale")
}
if (!product.available) {
quickview.find("select, input, .dec, .inc, .variants label").remove();
quickview.find(".add_to_cart_detail").text("Unavailable").addClass("disabled").attr("disabled", "disabled");
$(".quantity_wanted_p").css("display", "none");
}
else {
QuickViewVariantsSwatch(product, quickview);
}
Currency.convertAll(window.shop_currency, $("#currencies a.selected").data("currency"), "span.money", "money_format")
$("#quick-view-product").fadeIn(500);
$(".view_scroll_spacer").removeClass("hidden");
loadQuickViewSlider(product, quickview);
//initQuickviewAddToCart();
$(".quick-view").fadeIn(500);
if ($(".quick-view .total-price").length > 0) {
$(".quick-view input[name=quantity]").on("change", updatePricingQuickView)
}
updatePricingQuickView();
// Setup listeners to add/subtract from the input
$(".js-qty__adjust").on("click", function() {
var el = $(this),
id = el.data("id"),
qtySelector = el.siblings(".js-qty__num"),
qty = parseInt(qtySelector.val().replace(/\D/g, ''));
var qty = validateQty(qty);
// Add or subtract from the current quantity
if (el.hasClass("js-qty__adjust--plus")) {
qty = qty + 1;
} else {
qty = qty - 1;
if (qty <= 1) qty = 1;
}
// Update the input's number
qtySelector.val(qty);
updatePricingQuickView();
});
$(".js-qty__num").on("change", function() {
updatePricingQuickView();
});
});
return false;
});
// $(".quick-view").fancybox({
// maxWidth : 1170,
// maxHeight : 800,
// width : '80%',
// autoSize : true,
// closeClick : false,
// openSpeed : 2000,
// title : false
// });
}
function loadQuickViewSlider(n, r) {
productImage();
var s = Shopify.resizeImage(n.featured_image, "grande");
r.find(".quickview-featured-image").append('');
if (n.images.length > 0) {
var o = r.find(".more-view-wrapper ul");
for (i in n.images) {
var u = Shopify.resizeImage(n.images[i], "grande");
var a = Shopify.resizeImage(n.images[i], "compact");
var f = '
';
o.append(f)
}
/*o.find("a").click(function() {
var t = r.find(".quickview-featured-image img");
var n = r.find(".quickview-featured-image div");
if (t.attr("src") != e(this).attr("data-image")) {
t.attr("src", e(this).attr("data-image"));
n.show();
t.load(function(t) {
n.hide();
e(this).unbind("load");
n.hide()
})
}
});
*/
if(n.images.length <5){
$(".view_scroll_spacer").addClass("hidden");
}
} else {
r.find(".quickview-more-views").remove();
r.find(".quickview-more-view-wrapper-jcarousel").remove()
}
productImage();
}
function updateQuantity(){
$('.js-qty__adjust').on('click', function() {
var el = $(this),
id = el.data('id'),
qtySelector = el.siblings('.js-qty__num'),
qty = parseInt(qtySelector.val().replace(/\D/g, ''));
var qty = validateQty(qty);
// Add or subtract from the current quantity
if (el.hasClass('js-qty__adjust--plus')) {
qty = qty + 1;
} else {
qty = qty - 1;
if (qty <= 1) qty = 1;
}
// Update the input's number
qtySelector.val(qty);
updatePricing();
});
}
validateQty = function (qty) {
// Make sure we have a valid integer
if((parseFloat(qty) == parseInt(qty)) && !isNaN(qty)) {
// We have a number!
} else {
// Not a number. Default to 1.
qty = 1;
}
return qty;
};
var convertToSlug = function (e) {
return e.toLowerCase().replace(/[^a-z0-9 -]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-")
}
function QuickViewVariantsSwatch(t, quickview) {
if (t.variants.length > 1) {
for (var r = 0; r < t.variants.length; r++) {
var i = t.variants[r];
var s = '";
quickview.find("form.variants > select").append(s)
}
new Shopify.OptionSelectors("product-select-" + t.id, { product: t, onVariantSelected: selectCallbackQuickView });
var o = window.file_url.substring(0, window.file_url.lastIndexOf("?"));
var u = window.asset_url.substring(0, window.asset_url.lastIndexOf("?"));
var a = "";
for (var r = 0; r < t.options.length; r++) {
a += '
';
a += '
' + t.options[r].name + "
";
var f = false;
if (/Color|Colour/i.test(t.options[r].name)) { f = true } var l = new Array;
for (var c = 0; c < t.variants.length; c++) {
var i = t.variants[c]; var h = i.options[r];
var p = this.convertToSlug(h);
var d = "swatch-" + r + "-" + p;
if (l.indexOf(h) < 0) {
a += '
';
if (f) {
a += '
' + h + "
"
}
a += '";
if (f) {
a += ''
}
else {
a += ''
}
a += "
";
if (i.available) {
$('.quick-view .swatch[data-option-index="' + r + '"] .' + p).removeClass("soldout").addClass("available").find(":radio").removeAttr("disabled")
} l.push(h)
}
} a += "
"
}
quickview.find("form.variants > select").after(a);
quickview.find(".swatch :radio").change(function () {
var t = $(this).closest(".swatch").attr("data-option-index");
var quickview = $(this).val();
$(this).closest("form").find(".single-option-selector").eq(t).val(quickview).trigger("change");
});
if (t.available) {
Shopify.optionsMap = {};
linkOptionSelectors(t);
}
addCheckedSwatch();
}
else {
quickview.find("form.variants > select").remove();
var v = '';
quickview.find("form.variants").append(v)
}
}
$(document).on('click', '.quick-view', function(e){
e.preventDefault();
});
$(document).on('click', '.quickview-close, #quick-view-product .quickview-overlay', function(e){
$("#quick-view-product").fadeOut(500);
});
function displayImage(domAAroundImgThumb)
{
if (domAAroundImgThumb.attr('href'))
{
var new_src = domAAroundImgThumb.attr('href').replace('1024x1024', 'grande');
var new_title = domAAroundImgThumb.attr('title');
var new_href = domAAroundImgThumb.attr('href');
if ($('#bigpic').attr('src') != new_src)
{
$('#bigpic').attr({
'src' : new_src,
'alt' : new_title,
'title' : new_title
});
}
$('#views_block li').removeClass('shown');
$(domAAroundImgThumb).parent().addClass('shown');
}
}
function productZoom(){
$('.jqzoom').jqzoom({
zoomType: 'innerzoom', //innerzoom/standard/reverse/drag
zoomWidth: 458, //zooming div default width(default width value is 200)
zoomHeight: 458, //zooming div default width(default height value is 200)
xOffset: 21, //zooming div default offset(default offset value is 10)
yOffset: 0,
title: false
});
}
function productImage(){
$('#thumblist').height(parseInt($('#thumblist >li').outerHeight(true) * $('#thumblist >li').length) + 'px').css('marginBottom');
$('#thumbs_list').serialScroll({
items:'li:visible',
prev:'#view_scroll_left',
next:'#view_scroll_right',
axis:'y',
start:0,
stop:true,
duration:500,
step: 1,
lazy: true,
lock: false,
force:false,
cycle:true
});
$('#thumblist_qview').width(parseInt($('#thumblist_qview >li').outerWidth(true) * $('#thumblist_qview >li').length) + 'px').css('marginRight');
$('#thumbs_list_qview').serialScroll({
items:'li:visible',
prev:'.view_scroll_left',
next:'.view_scroll_right',
axis:'x',
start:0,
stop:true,
duration:500,
step: 1,
lazy: true,
lock: false,
force:false,
cycle:true
});
$('.thumbs_list_frame_2').height(parseInt($('.thumbs_list_frame_2 >li').outerHeight(true) * $('.thumbs_list_frame_2 >li').length) + 'px').css('marginBottom');
$('.thumbs_list_2').serialScroll({
items:'li:visible',
prev:'.view_scroll_left',
next:'.view_scroll_right',
axis:'y',
start:0,
stop:true,
duration:500,
step: 1,
lazy: true,
lock: false,
force:false,
cycle:true
});
if (!!$.prototype.fancybox){
$('li:visible .fancybox, .fancybox.shown').fancybox({
'hideOnContentClick': true,
'openEffect' : 'elastic',
'closeEffect' : 'elastic'
});
}
}
// Used to compensante Chrome/Safari bug (they don't care about scroll bar for width)
function scrollCompensate()
{
var inner = document.createElement('p');
inner.style.width = "100%";
inner.style.height = "200px";
var outer = document.createElement('div');
outer.style.position = "absolute";
outer.style.top = "0px";
outer.style.left = "0px";
outer.style.visibility = "hidden";
outer.style.width = "200px";
outer.style.height = "150px";
outer.style.overflow = "hidden";
outer.appendChild(inner);
document.body.appendChild(outer);
var w1 = inner.offsetWidth;
outer.style.overflow = 'scroll';
var w2 = inner.offsetWidth;
if (w1 == w2) w2 = outer.clientWidth;
document.body.removeChild(outer);
return (w1 - w2);
}
function responsiveResize()
{
compensante = scrollCompensate();
if (($(window).width()+scrollCompensate()) <= 767 && responsiveflag == false)
{
//accordion('enable');
accordionFooter('enable');
responsiveflag = true;
}
else if (($(window).width()+scrollCompensate()) >= 768)
{
//accordion('disable');
accordionFooter('disable');
responsiveflag = false;
}
}
function setLeftColumn(){
$('body').append($(''));
$('.drag-target').click(function(){
$('#left_column').addClass('side-nav');
$('.over-cover').show();
});
}
function offCanvas(){
$('[data-toggle="offcanvas"]').click(function (e) {
var menuCanvas = $(this).data('target');
$(this).toggleClass('open');
$(menuCanvas).toggleClass('active');
$('body').toggleClass('off-canvas-active');
var heightCanvas = $(window).height();
$(menuCanvas).css({'min-height' : heightCanvas});
e.stopPropagation();
});
$('.off-canvas-nav').click(function () {
$('[data-toggle="offcanvas"]').click();
});
$('[data-toggle="offcanvas-left"]').click(function (e) {
var menuCanvas = $(this).data('target');
$(this).toggleClass('open');
$(menuCanvas).toggleClass('active');
$('body').toggleClass('off-canvas-left-active');
var heightCanvas = $(window).height();
$(menuCanvas).css({'min-height' : heightCanvas});
e.stopPropagation();
});
}
function accordion(status)
{
leftColumnBlocks = $('#left_column');
if(status == 'enable')
{
if(!$('#left_column').hasClass('accordion')){
$('#right_column .block .title_block, #left_column .block .title_block').on('click', function(){
$(this).toggleClass('active').parent().find('.block_content').stop().slideToggle('medium');
});
}
$('#right_column, #left_column').addClass('accordion');
}
else
{
$('#right_column .block .title_block, #left_column .block .title_block').removeClass('active').off().parent().find('.block_content').removeAttr('style').slideDown('fast');
$('#left_column, #right_column').removeClass('accordion');
}
}
function accordionFooter(status)
{
if(status == 'enable') {
if(!$('#footer').hasClass('accordion')){
$('#footer .footer-block h4').on('click', function(){
$(this).toggleClass('active').parent().find('.block_content').stop().slideToggle('medium');
})
}
$('#footer').addClass('accordion').find('.block_content').slideUp('fast');
}
else {
$('.footer-block h4').removeClass('active').off().parent().find('.block_content').removeAttr('style').slideDown('fast');
$('#footer').removeClass('accordion');
}
}
//Float Menu
function processFloatHeader(headerAdd, scroolAction){
if(headerAdd){
$("#header").addClass( "navbar-fixed-top" );
$("#page").css( "padding-top", $("#header").height());
var hideheight = $("#header").height()+120;
var pos = $(window).scrollTop();
if( scroolAction && pos >= hideheight ){
$("#topbar").addClass('hide-bar');
$(".hide-bar").css( "margin-top", - $("#topbar").height() );
$(".header-bottom").css( "display", "none" );
}else {
$("#topbar").css( "margin-top", 0 );
$(".header-bottom").css( "display", "block" );
}
}else{
$("#header").removeClass( "navbar-fixed-top" );
$("#page").css( "padding-top", '');
$("#header-main").removeClass('hidden');
$("#apollo-menu").removeClass('hidden');
$("#topbar").css( "margin-top", 0 );
}
}
function processFloatTopbar(topbarAdd, scroolAction){
if(topbarAdd){
$("#header").addClass( "navbar-fixed-top" );
$("#page").css( "padding-top", $("#header").height());
var hideheightBar = $("#header").height()+120;
var pos = $(window).scrollTop();
if( scroolAction && pos >= hideheightBar ){
$("#header-main").addClass('hidden');
$("#apollo-menu").addClass('hidden');
}else {
$("#header-main").removeClass('hidden');
$("#apollo-menu").removeClass('hidden');
}
}else{
$("#header").removeClass("navbar-fixed-top");
$("#page").css( "padding-top", '');
$("#header-main").removeClass('hidden');
$("#apollo-menu").removeClass('hidden');
$("#topbar").css( "margin-top", 0 );
}
}
function floatHeader(){
$(window).resize(function(){
if (!$("body").hasClass("keep-header") || $(window).width() <= 990){
return;
}
if ($(window).width() <= 990)
{
processFloatHeader(0,0);
}
else if ($(window).width() > 990)
{
if ($("body").hasClass("keep-header"))
processFloatHeader(1,1);
}
});
$(window).scroll(function() {
if (!$("body").hasClass("keep-header")) return;
if($(window).width() > 990){
processFloatHeader(1,1);
}
});
}
function floatTopbar(){
$(window).resize(function(){
if (!$("body").hasClass("keep-topbar") || $(window).width() <= 990){
return;
}
if ($(window).width() <= 990)
{
processFloatTopbar(0,0);
}
else if ($(window).width() > 990)
{
if ($("body").hasClass("keep-topbar"))
processFloatTopbar(1,1);
}
});
$(window).scroll(function() {
if (!$("body").hasClass("keep-topbar")) return;
if($(window).width() > 990){
processFloatTopbar(1,1);
}
});
}
// Back to top
function backtotop(){
// Hide #back-top first
$("#back-top").hide();
// Fade in #back-top
$(function () {
$(window).scroll(function () {
if ($(this).scrollTop() > 100) {
$('#back-top').fadeIn();
} else {
$('#back-top').fadeOut();
}
});
// Scroll body to 0px on click
$('#back-top a').click(function () {
$('body,html').animate({
scrollTop: 0
}, 800);
return false;
});
});
}
function panelTool(){
$('#paneltool .panelbutton').click(function(){
$('#paneltool .paneltool').toggleClass('active');
});
}
function changeFloatHeader(){
$('#floatHeader').click(function(){
if ($('body').hasClass('keep-header')) {
$('body').removeClass('keep-header');
processFloatHeader(0,0);
}
else{
processFloatTopbar(0,0);
$('body').addClass('keep-header');
$('body').removeClass('keep-topbar');
$("#floatTopbar").prop("checked", false);
};
});
$('#floatTopbar').click(function(){
if ($('body').hasClass('keep-topbar')) {
$('body').removeClass('keep-topbar');
processFloatTopbar(0,0);
}
else{
processFloatHeader(0,0);
$('body').addClass('keep-topbar');
$('body').removeClass('keep-header');
$("#floatHeader").prop("checked", false);
};
});
}
function changeLayoutMode(){
$('.dynamic-update-layout').click(function(){
var currentLayoutMode = $('.dynamic-update-layout.selected').data('layout-mode');
if(!$(this).hasClass('selected'))
{
$('.dynamic-update-layout').removeClass('selected');
$(this).addClass('selected');
selectedLayout = $(this).data('layout-mode');
$('body').removeClass(currentLayoutMode);
$('body').addClass(selectedLayout);
}
});
}
function changeHeaderStyle(){
$('.dynamic-update-header').click(function(){
var currentHeaderMode = $('.dynamic-update-header.selected').data('header-style');
if(!$(this).hasClass('selected'))
{
$('.dynamic-update-header').removeClass('selected');
$(this).addClass('selected');
selectedHeaderStyle = $(this).data('header-style');
$('body').removeClass(currentHeaderMode);
$('body').addClass(selectedHeaderStyle);
}
});
}
function addFilterEffect(){
if($("#catalog_block").length && $("#catalog_block").hasClass('ajax-filter')){
//if this page is collection page
if($('.catalog_filters').length){
$('.advanced-filter').each(function(){
dataGroup = $(this).data('group');
if(dataGroup != "Vendor"){
activeFilter='';
if($(this).hasClass('active-filter'))
activeFilter=' checked="checked"';
$('a', $(this)).each(function(){
var dataHandle = $(this).parent().data("handle");
$('').insertBefore($(this));
$(this).click(function(event){
chkVal = $(this).parent().find('.chkval');
chkVal.prop("checked", !chkVal.prop("checked"));
$(this).parent().toggleClass("active-filter");
FilterLoadResult();
return false;
});
})
}
});
}
//add ajax for sort
$("#SortBy").change(function(event){
event.preventDefault();
var url = window.location.href;
url = replaceUrlParam(url, 'sort_by', $(this).val());
processCollectionAjax(url);
return false;
});
//add ajax for view
$(".change-view").click(function(event){
event.preventDefault();
if($(this).hasClass('change-view--active')) return false;
$(".change-view").removeClass('change-view--active');
$(this).addClass('change-view--active');
var url = window.location.href;
url = replaceUrlParam(url, 'view', $(this).data('view'));
//add class for product list
processCollectionAjax(url);
$('.product_list').removeClass('list').removeClass('grid').addClass($(this).data('view'));
return false;
});
pagingCollection();
}
}
function pagingCollection(){
activeNumber = parseInt($('.pagination li.active span').html());
$('#pagination .pagination a').click(function(){
var pageNumber = 0;
//previous
if($(this).parent().hasClass('pagination_previous')){
pageNumber = activeNumber-1;
}
//next
else if($(this).parent().hasClass('pagination_next')){
pageNumber = activeNumber+1;
}
//normal paging
else{
pageNumber = parseInt($(this).html());
}
if(pageNumber >0){
var url = window.location.href;
url = replaceUrlParam(url, 'page', pageNumber);
processCollectionAjax(url);
}
return false;
});
}
function FilterLoadResult(){
var url = window.location.href;
var constraint = '';
$('.chkval').each(function(){
if($(this).is(":checked"))
constraint += !constraint?$(this).val().toLowerCase():"+"+$(this).val().toLowerCase();
});
url = replaceUrlParam(url, 'constraint', constraint);
processCollectionAjax(url);
}
function processCollectionAjax(url){
$.ajax({
type: 'GET',
url: url,
data: {},
beforeSend:function(){
$('.product_list').addClass('loading');
},
complete: function (data) {
$('.product_list').html($(".product_list", data.responseText).html());
$('#pagination').remove();
$('.content_sortPagiBar').html($(".content_sortPagiBar", data.responseText).html());
$('.product_list').removeClass('loading');
history.pushState({
page: url
}, url, url);
pagingCollection();
}
});
}
function menuleftResize(removeOpen){
if ($(document).width() >990)
{
$('.verticalmenu .dropdown').removeClass('open');
$('.verticalmenu').addClass('active-hover');
}else{
$('.verticalmenu').removeClass('active-hover');
}
}
function scrollSliderBarMenu(){
var menuElement = $(".float-vertical");
var columnElement = null;
var maxWindowSize = 990;
if($(menuElement).hasClass('float-vertical-right'))
columnElement = $("#right_column");
else if($(menuElement).hasClass('float-vertical-left'))
columnElement = $("#left_column");
//auto display slider bar menu when have left or right column
if($(columnElement).length && $(window).width()>=maxWindowSize) showOrHideSliderBarMenu(columnElement, menuElement, 1);
$(".float-vertical-button").click(function(){
if($(menuElement).hasClass('active')) showOrHideSliderBarMenu(columnElement, menuElement, 0);
else showOrHideSliderBarMenu(columnElement, menuElement, 1);
});
var lastWidth = $(window).width();
$(window).resize(function() {
if($(window).width()!=lastWidth){
if($(window).width()=990)
columnElement.css('padding-top',($('.block_content',$(menuElement)).height() - 90)+'px');
}else{
$(menuElement).removeClass('active');
if($(columnElement).length) columnElement.css('padding-top','');
}
}
function addCheckedSwatch(){
$('.swatch .color label').on('click', function () {
$('.swatch .color').each(function(){
$(this).find('label').removeClass('checkedBox');
});
$(this).addClass('checkedBox');
});
}
/*START LEFT- RIGHT MENU*/
function setLeftColumn() {
if($("#left_column").length > 0) {
if($(".over-cover").length == 0) {
$('body').append($('