').css({
overflowY: 'scroll',
width: '50px',
height: '50px',
visibility: 'hidden'
});
$body.append($div);
var scrollWidth = $div.get(0).offsetWidth - $div.get(0).clientWidth;
$div.remove();
return scrollWidth;
};
$body.css({
overflowY: 'hidden',
paddingRight: scrollWidth()
});
$stuck.css({
paddingRight: scrollWidth()
});
$btn_top.css({
right: scrollWidth()
});
$('.tt-header-static').length && $('.tt-header-static').css({'padding-right': scrollWidth()});
}
};
if ($ttDesctopMenu.length > 0) {
$('.tt-megamenu-submenu li').each(function(){
if($(this).find('img').length){
$(this).closest('ul').addClass('tt-sub-img');
}
});
$ttDesctopMenu.find('.dropdown-menu').each(function(){
if($(this).length){
$(this).closest('.dropdown').addClass('tt-submenu');
}
});
$(document).on({
mouseenter: function() {
var $this = $(this),
that = this,
windowW = window.innerWidth || $(window).width();
if (windowW > 1025 && $body.hasClass('touch-device')) {
$ttDesctopMenu.find('.dropdown.tt-submenu > a').one("click", false);
};
timeout1 = setTimeout(function () {
var $carousel = $this.find('.tt-menu-slider'),
$ttDesctopMenu = $this.find('.dropdown-menu');
$this.addClass('active')
.find(".dropdown-menu")
.stop()
.addClass('hover')
.fadeIn(hoverTimer);
if($ttDesctopMenu.length & !$ttDesctopMenu.hasClass('one-col')) {
set_dropdown_maxH.call(that);
}
if($carousel.length) {
if(!$carousel.hasClass('slick-initialized')) {
$carousel.slick({
dots: false,
arrows: true,
infinite: true,
speed: 300,
slidesToShow: 3,
slidesToScroll: 3,
adaptiveHeight: true
});
}
};
$carousel.slick('setPosition');
}, delay);
},
mouseleave: function(e) {
var $this = $(this),
$dropdown = $this.find(".dropdown-menu");
if($(e.target).parents('.dropdown-menu').length && !$(e.target).parents('.tt-megamenu-submenu').length && !$(e.target).parents('.one-col').length) return;
if(timeout1 !== false) {
clearTimeout(timeout1);
timeout1 = false;
}
if($dropdown.length) {
$dropdown.stop().fadeOut({duration: 0, complete: function() {
$this.removeClass('active')
.find(".dropdown-menu")
.removeClass('hover');
}});
} else {
$this.removeClass('active')
.find(".dropdown-menu")
.removeClass('hover');
}
$dropdown.removeAttr('style');
$('.tt-header-static').length && $('.tt-header-static').removeAttr('style');
if(!$('body').hasClass('notdelete')){
$body.removeAttr('style');
}
$('.tt-stuck-nav').css({
paddingRight: 'inherit'
});
blocks.ttBackToTop.css({
right: 0
});
}
}, '.tt-desctop-menu li');
$('.multicolumn ul li').hover(function() {
var $ul = $(this).find('ul:first');
if ($ul.length) {
var windW = window.innerWidth,
windH = window.innerHeight,
ulW = parseInt($ul.css('width'), 10),
thisR = this.getBoundingClientRect().right,
thisL = this.getBoundingClientRect().left;
if (windW - thisR < ulW) {
$ul.removeClass('left').addClass('right');
} else if (thisL < ulW) {
$ul.removeClass('right').addClass('left');
} else {
$ul.removeClass('left right');
}
$ul.stop(true, true).fadeIn(300);
}
}, function() {
$(this).find('ul:first').stop(true, true).fadeOut(300).removeAttr('style');
});
$ttDesctopMenu.find('.tt-megamenu-submenu li').hover(function() {
var $ul = $(this).find('ul:first');
if ($ul.length) {
var $dropdownMenu = $(this).parents('.dropdown').find('.dropdown-menu'),
dropdown_left = parseInt($(this).get(0).getBoundingClientRect().left, 10),
dropdown_Right = $dropdownMenu.get(0).getBoundingClientRect().right,
dropdown_Bottom = $dropdownMenu.get(0).getBoundingClientRect().bottom,
ulW = parseInt($ul.css('width'), 10),
thisR = this.getBoundingClientRect().right,
thisL = this.getBoundingClientRect().left,
compareValue = parseInt(ulW + dropdown_left + 170, 10),
ttwindowWidth = window.innerWidth;
if (ttwindowWidth <= compareValue) {
$(this).find('ul:first').removeClass('left').addClass('right');
} else if (ttwindowWidth > compareValue) {
$(this).find('ul:first').css({left: parseInt($(this).find('a').innerWidth(), 10)}).removeClass('right').addClass('left');
};
$ul.stop(true, true).delay(150).fadeIn(300);
var ul_bottom = $ul.get(0).getBoundingClientRect().bottom;
if (dropdown_Bottom < ul_bottom) {
var move_top = dropdown_Bottom - ul_bottom;
$ul.css({
top: move_top
});
}
}
}, function() {
$(this).find('ul:first').stop(true, true).fadeOut(300).removeAttr('style');
});
$('.megamenu div').hover(function() {
$(this).children('.tt-title-submenu').addClass('active');
}, function() {
$(this).children('.tt-title-submenu').removeClass('active');
});
}
function onscroll_dropdown_hover() {
var $dropdown_active = $('.dropdown.hover');
if (!$dropdown_active.find('.dropdown-menu').not('.one-col').length) return;
if ($dropdown_active.length)
set_dropdown_maxH.call($dropdown_active);
};
$(window).on('scroll', function() {
onscroll_dropdown_hover();
});
})();
/*!
* jQuery Cookie Plugin v1.4.1
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2006, 2014 Klaus Hartl
* Released under the MIT license
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else if (typeof exports === 'object') {
module.exports = factory(require('jquery'));
} else {
factory(jQuery);
}
}(function ($) {
var pluses = /\+/g;
function encode(s) {
return config.raw ? s : encodeURIComponent(s);
}
function decode(s) {
return config.raw ? s : decodeURIComponent(s);
}
function stringifyCookieValue(value) {
return encode(config.json ? JSON.stringify(value) : String(value));
}
function parseCookieValue(s) {
if (s.indexOf('"') === 0) {
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
}
try {
s = decodeURIComponent(s.replace(pluses, ' '));
return config.json ? JSON.parse(s) : s;
} catch(e) {}
}
function read(s, converter) {
var value = config.raw ? s : parseCookieValue(s);
return $.isFunction(converter) ? converter(value) : value;
}
var config = $.cookie = function (key, value, options) {
if (arguments.length > 1 && !$.isFunction(value)) {
options = $.extend({}, config.defaults, options);
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setMilliseconds(t.getMilliseconds() + days * 864e+5);
}
return (document.cookie = [
encode(key), '=', stringifyCookieValue(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
var result = key ? undefined : {},
cookies = document.cookie ? document.cookie.split('; ') : [],
i = 0,
l = cookies.length;
for (; i < l; i++) {
var parts = cookies[i].split('='),
name = decode(parts.shift()),
cookie = parts.join('=');
if (key === name) {
result = read(cookie, value);
break;
}
if (!key && (cookie = read(cookie)) !== undefined) {
result[name] = cookie;
}
}
return result;
};
config.defaults = {};
$.removeCookie = function (key, options) {
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
return !$.cookie(key);
};
}));
function subscribeErrorHandler(){
if($('.errors').length == 0) return false;
$('[type="email"]').on('focus', function(){
$(this).unbind().closest('form').find('.errors').length && $(this).closest('form').find('.errors').remove();
})
}
subscribeErrorHandler();
/* Sections */
var hoverColors = {
params: {
baseColor: 'data-c',
activeColor: 'data-ac',
bgBaseColor: 'data-bgc',
bgActiveColor: 'data-abgc',
borderBaseColor: 'data-borc',
borderActiveColor: 'data-aborc',
},
init: function(){
var attrName = this.params;
var he = $('[data-hovercolors]');
if(he.length == 0) return false;
he.each(function(){
hoverColors.getCurrentColors($(this), attrName.baseColor, attrName.bgBaseColor, attrName.borderBaseColor);
});
},
initEvents: function(){
var attrName = this.params;
$('body').on({
mouseenter: function(){
hoverColors.getCurrentColors($(this), attrName.activeColor, attrName.bgActiveColor, attrName.borderActiveColor );
},
mouseleave: function(){
hoverColors.getCurrentColors($(this), attrName.baseColor, attrName.bgBaseColor, attrName.borderBaseColor );
}}, '[data-hovercolors]'
);
},
getCurrentColors: function(_, attr1, attr2, attr3){
hoverColors.setCurrentColors(_, attr1, attr2, attr3);
var attr = false;
var ac = _.find('['+ attr1 +']');
if(ac.length > 0) {
ac.each(function(){
attr = $(this).attr("use-on-hover");
if (typeof attr !== typeof undefined && attr !== false && _ != $(this)) return true;
var c = $(this).attr(attr1);
$(this).css('color', c);
});
}
ac = _.find('['+ attr2 +']');
if(ac.length > 0) {
ac.each(function(){
attr = $(this).attr("use-on-hover");
if (typeof attr !== typeof undefined && attr !== false && _ != $(this)) return true;
hoverColors.setCurrentBgColor($(this), attr2);
});
}
ac = _.find('['+ attr3 +']');
if(ac.length > 0) {
ac.each(function(){
attr = $(this).attr("use-on-hover");
if (typeof attr !== typeof undefined && attr !== false && _ != $(this)) return true;
hoverColors.setCurrentBorderColor($(this), attr3);
});
}
},
setCurrentBgColor: function(_, attr){
var a = _.attr(attr);
_.css({"background": a});
},
setCurrentBorderColor: function(_, attr){
var a = _.attr(attr);
if (typeof a !== typeof undefined && a !== false) {
_.css('border-color', a);
}
},
setCurrentColors: function(_, attr1, attr2, attr3){
var c = _.attr(attr1);
_.css('color', c);
hoverColors.setCurrentBgColor(_, attr2);
hoverColors.setCurrentBorderColor(_, attr3);
return false;
}
}
hoverColors.initEvents();
// Countdown
function countDown(showZero) {
if ($(".tt-countdown").length) {
var showZero = showZero || false;
$(".tt-countdown").each(function() {
var $this = $(this),
date = $this.data('date'),
nextYear = false,
tz = $('[name=timezone]');
if(typeof moment === "function" && tz.length) nextYear = moment.tz($this.data('date'), tz.attr('content'));
if (date = date.split('-')) {
date = date.join('/');
} else return;
var timezone = nextYear ? nextYear.toDate() : date;
$this.countdown(timezone, function(e) {
var format = '';
function addFormat(func, timeNum, showZero) {
if(timeNum === 0 && !showZero) return;
func(format);
};
addFormat(function() {
format += ''
+ '' + e.offset.totalDays + ''
+ '' + set_day + ''
+ '';
}, e.offset.totalDays, showZero);
addFormat(function() {
format += ''
+ '' + e.offset.hours + ''
+ '' + set_hour + ''
+ '';
}, e.offset.hours, showZero);
addFormat(function() {
format += ''
+ '' + e.offset.minutes + ''
+ '' + set_minute + ''
+ '';
}, e.offset.minutes, showZero);
addFormat(function() {
format += ''
+ '' + e.offset.seconds + ''
+ '' + set_second + ''
+ '';
}, e.offset.seconds, showZero);
format += '';
$(this).html(format);
});
});
}
};
$(document).ready(function() {
"use strict";
countDown(true);
initProductOptions();
});
/* products options */
function initProductOptions(){
$('body').on('change', '.productitem-option1-combo-js select', function(e){
var $this = $(this).find('option:selected');
setNewData($this, true);
var val = $this.attr("data-tag") + '-js';
var _parent = $this.closest('.tt-option-block');
val = _parent.optionsSetParams(val, '.productitem-option2-js');
_parent.optionsSetParams(val, '.productitem-option3-js');
})
$('body').on('click', '.productitem-option1-js a', function(e){
var $this = $(this);
optionsHandler(e, $this);
var val = $this.parent().attr("data-tag") + '-js';
var _parent = $this.closest('.tt-option-block');
val = _parent.optionsSetParams(val, '.productitem-option2-js');
_parent.optionsSetParams(val, '.productitem-option3-js');
})
$('body').on('click', '.productitem-option2-js a', function(e){
var $this = $(this)
optionsHandler(e, $this);
var val = $this.parent().attr("data-tag") + '-js';
var _parent = $this.closest('.tt-option-block');
_parent.optionsSetParams(val, '.productitem-option3-js');
});
$('body').on('click', '.productitem-option3-js a', function(e){
optionsHandler(e, $(this));
});
}
function optionsHandler(e, $this){
e.preventDefault();
if($this.parent().hasClass('active')) return false;
setNewData($this);
}
$.fn.optionsSetParams = function(val, str){
var _opt = this.find(str);
if(_opt.length == 0) return false;
_opt.show().find('li').each(function(){ $(this).hide().removeClass('active') });
if(_opt.find('[data-current-option="'+val+'"]').length == 0) return false;
_opt.find('[data-current-option="'+val+'"]').show().first().addClass('active');
return _opt.find('.active').find('a').parent().attr("data-tag") + '-js';
}
function setNewData($this, combobox){
if (combobox === undefined) {
combobox = false;
}
var _parent = combobox ? $this : $this.parent();
if(!combobox){
_parent.parent().find(".active").removeClass('active');
_parent.addClass('active');
}
var availability = Boolean(_parent.data('variant_availability'));
var $pr_parent = $this.closest('.options-js');
$pr_parent.find('input').val(_parent.attr('data-var_id'));
var img_src = _parent.attr('data-img');
if(img_src != ''){
if($(window).width() > '1024' && $pr_parent.find('.tt-img-roll-over').length) {
$pr_parent.find('.tt-img-roll-over img').attr('src', img_src).removeAttr('srcset data-src data-srcset').removeClass('lazyload');
}
else{
$pr_parent.find('.tt-img img').attr('src', img_src).removeAttr('srcset data-src data-srcset').removeClass('lazyload');
}
if($pr_parent.find('[data-mainimage]').length){
$pr_parent.find('[data-mainimage]').removeAttr('data-mainimage').parent().css('height', 'auto');
}
}
var $btn = $pr_parent.find('.tt-btn-addtocart');
$btn.attr('href', '/cart/add.js?quantity=1&id='+_parent.attr('data-var_id'));
if($pr_parent.find('.compare-js').length){
$pr_parent.find('.compare-js').attr('data-compareid', _parent.attr('data-var_id'));
$(window).trigger( "compareevent" );
}
availability ? $btn.html(_parent.attr('data-buttonname')).removeClass('disable') : $btn.html(unavailable_text).addClass('disable');
var labelsale = $pr_parent.find('.tt-label-sale');
var mainprice = $pr_parent.find('.tt-price span:first-child');
var oldprice = $pr_parent.find('.old-price');
mainprice.html(Shopify.formatMoney(_parent.attr('data-price'), money_format));
var compprice = String(_parent.attr('data-compprice'));
oldprice.html(Shopify.formatMoney(compprice, money_format));
if(!compprice) {
!oldprice.hasClass('hide') && oldprice.addClass('hide');
mainprice.hasClass('new-price') && mainprice.removeClass('new-price');
labelsale.length && labelsale.hide();
}
else {
var _mainprice = Number(_parent.attr('data-price'));
compprice = Number(compprice);
if(_mainprice >= compprice){
!oldprice.hasClass('hide') && oldprice.addClass('hide');
mainprice.hasClass('new-price') && mainprice.removeClass('new-price');
labelsale.length && labelsale.hide();
}
else{
oldprice.hasClass('hide') && oldprice.removeClass('hide');
!mainprice.hasClass('new-price') && mainprice.addClass('new-price');
var per = Math.round(100 - (_mainprice / compprice)*100)+'%';
labelsale.length && labelsale.show().find('.thumb_percent').html(per);
}
}
/* variant_price = labelsale.data('price')
percent = Math.round(100 - (variant.price / variant.compare_at_price)*100);*/
$('body').trigger('refreshCurrency');
}
/* Section */
$(document)
.on('shopify:section:load', eventHandler)
.ready(function() {
$('[data-sectionname]').each(function(){ $(this).initSection() });
$('[data-mainimage]').length && $(window).resize(initImagesSizeResize);
initImagesSize('start');
lazyload();
});
function eventHandler(e) {
$('#' + e.target.id).find('[data-sectionname]').initSection();
initImagesSize();
lazyload();
if (Shopify.designMode && typeof "product_page_1_description_handler" === "function"){
$(document)
.on('shopify:section:select', product_page_1_description_handler);
}
}
initImagesSize();
function initImagesSizeResize(){
setTimeout(function(){initImagesSize('resize')}, 100)
}
function initImagesSize(e){
if(!$('[data-mainimage]').length) return false;
$('[data-mainimage]').each(function(){
var _ = $(this),
wn = _.closest('.respimgsize.product-parent').find('.tt-image-box').length ? _.closest('.respimgsize').find('.tt-image-box').width() : _.closest('.respimgsize').width(),
w = Math.min(wn, 2000) + 'x',
w2= wn*2 + 'x',
i = _.attr('data-mainimage').replace('respimgsize', w),
i2 = _.attr('data-mainimage').replace('respimgsize', w2),
attr = _.attr('data-mainimageratio');
if(w == '0x') return false;
var dwidth = _.attr('data-width');
if (typeof dwidth !== typeof undefined && dwidth !== false && !_.is(":visible")){
dwidth = Math.min(Number(dwidth), 2000);
w = dwidth + 'x',
w2= dwidth*2 + 'x',
i = _.attr('data-mainimage').replace('respimgsize', w),
i2 = _.attr('data-mainimage').replace('respimgsize', w2);
}
_.attr('data-srcset', i+' 1x,'+i2+' 2x');
if(e == 'resize'){
_.attr('srcset', i+' 1x,'+i2+' 2x');
}
if(e == 'start' && !_.closest('.product-parent').length){
setTimeout(function(){_.attr('srcset', i+' 1x,'+i2+' 2x')}, 3000);
}
if(!$('#same_product_height').length && _.closest('.product-parent').length){
var h = wn/Number(attr);
_.parent().css('height', h).css('display', 'block');
}
})
}
$.fn.initSection = function(){
var _ = this;
var n = _.data('sectionname');
switch (n) {
case ("index_sectionconstbann"): _.find('.contbanslider').initSlick(1, 1, 1,false); break;
case ("index_sectionproducts"): var m = Number(_.find('.tt-carousel-products-js').attr('data-mobile'));
var a = _.find('.tt-carousel-products-js').attr('data-adaptive') == "true" ? true: false;
_.find('.tt-carousel-products-js').initSlick(3, m, m, a); break;
case ("index_horizontaltabs"): _.initTabs(); break;
case ("index_verticaltabs"): _.initTabs(1); break;
case ("index_sectionlookbook"): _.find('.tt-carousel-lookbook').initSlickLookbook(3, 2, 1); break;
case ("index_sectionlookbookmasonry"): _.find('.tt-lookbook-init').initMasonryLookbook(); break;
case ("index_sectionmasonry_products"): _.find('.tt-product-index-init').initMasonryLookbook(); break;
case ("index_brands"): _.find('.tt-carousel-brands').initSlickBrands(6, 4, 3, 2, 1); break;
case ("index_testimonials"): _.find('.tt-slider-fullwidth').initSlick(1, 1, 1); break;
case ("index_revolution"): _.find('.slider-revolution').initRevolution(); break;
case ("index_iconbanners2"): _.find('.tt-single-text-with-icons').initSigleTextWithIcon(); break;
case ("product-recommendations"): _.initProductPageRecommendations(); break;
case ("index_productandvideosection"): _.initVideoProductSection(); break;
case ("index_blurbssection"): _.find('.js-blurbs-slider').initBlurbssection(); _.find('.tt-blurbsreview-masonry').blurbsreviewMasonry(); break;
case ("index_sectionsingleproduct"): _.initSingleProductSection(); break;
case ("productpagesection"): product_page_1_description_handler(); break;
default: break;
}
}
$.fn.initSingleProductSection = function(){
var _this = this,
_select = _this.find('.col-select select'),
_price = _this.find('.tt-price'),
_loader = _this.find('.custom-loader'),
_image_box = _this.find('.productandvideoimg'),
_avaibility = _this.find('.availability'),
_input = _this.find('.tt-input-counter').find('input'),
u = _this.attr('data-prurl');
addToCartHandler.initFormAddToCartButton(false, _this, false);
if(_avaibility.length){
var global_quantity_qw = {};
var qa = _this.attr('data-quantity').split(';');
if(qa.length > 0){
for(var i = 0; i < qa.length; i++){
if(qa[i] === '') break;
var _qa = qa[i].split('-');
global_quantity_qw[_qa[0]] = _qa[1];
}
}
}
window.parent != window.top && _this.find('.tt-countdown_box_02').length && countDown(true);
Shopify.getProduct(u, productInfoJsonLoaded);
function productInfoJsonLoaded(json){
var _var = _select.find('option:selected').length == 0 ? json.variants[0] : json.variants[_select.find('option:selected').index()];
_avaibility.length && swatchAvaibility(_var, _avaibility, _input, global_quantity_qw);
_select.on('change', function(){
var i = $(this).find('option:selected').index(),
variant = json.variants[i],
src = variant.featured_image ? variant.featured_image.src.split('https:').pop() : json.featured_image.split('https:').pop();
_this.find('[name="id"]').attr('value', variant.id);
if(src != _image_box.find('img').attr('src')){
var img = new Image();
img.onload = function() {
_loader.length && _loader.stop().fadeOut();
_image_box.find('img').replaceWith(img);
}
_loader.length && _loader.stop().fadeIn();
img.src = src;
}
if(_price.length){
var price_str = Shopify.formatMoney(variant.price, money_format);
var price_comare_str = Shopify.formatMoney(variant.compare_at_price, money_format);
if(variant.price < variant.compare_at_price){
_price.find('>span:first').addClass('new-price').html(price_str);
_price.find('>span:last').removeClass('hide').html(price_comare_str);
}
else {
_price.find('>span:first').removeClass('new-price').html(price_str);
_price.find('>span:last').addClass('hide');
}
}
_avaibility.length && swatchAvaibility(variant, _avaibility, _input, global_quantity_qw);
var temp = global_quantity;
global_quantity = global_quantity_qw;
swatchVariantButtonHandler(_this, variant);
global_quantity = temp;
})
}
}
$.fn.initBlurbssection = function(){
var _this = this;
wresizeHandler();
$(window).bind('resize', wresizeHandler);
function wresizeHandler(){
if($(window).width() < 576)
!_this.hasClass('slick-slider') && setTimeout(initBlurbssectionSlider, 0);
else
_this.hasClass('slick-slider') && _this.slick('unslick');
}
function initBlurbssectionSlider(){
_this.slick({
lazyLoad: 'progressive',
dots: true,
arrows: false,
infinite: true,
speed: 300,
slidesToShow: 1,
slidesToScroll: 1,
adaptiveHeight: false
});
}
}
$.fn.initVideoProductSection = function(){
var _ = this.find('video');
_.on('click touchstart', function(){
_[0].play();
_.css('cursor', 'default');
})
$(window).scroll({obj: _},videoProductscrollW).resize({obj: _},videoProductscrollW);
}
function videoProductscrollW(e){
var v = e.data.obj,
wp = $(window).scrollTop(),
wh = $(window).height(),
p = v.offset().top,
h = v.height(),
dt = 0,
db = 100;
if(wp+wh > p+dt && wp < p+h-db){
v[0].play();
!v.hasClass('played') && v.addClass('played');
}
else{
if(v.hasClass('played')){
v.removeClass('played');
v[0].pause();
}
}
}
$.fn.initTabs = function(mobilegrid){
mobilegrid = mobilegrid || 2;
var _ = this;
if(!_.find('[role="tabpanel"]').length) return false;
var a = _.find('[role="tabpanel"]').first().find('.ajaxcontent');
getTabcontent(a, mobilegrid);
if(_.find('.nav-link').length){
_.on('mouseenter', function(){
$(this).unbind('mouseenter');
_.find('.nav-link').on('click', clickTabcontent).each(function(){
var href = $(this).attr('href');
getTabcontent($(href).find('.ajaxcontent'), mobilegrid);
})
})
}
}
function clickTabcontent(){
var $this = $(this);
setTimeout(function(){
$this.closest('[data-respjs]').find('.tab-pane.active').find('[data-mainimage]').each(function(){
var _ = $(this),
wn = _.closest('.respimgsize').width(),
w = wn + 'x',
w2= wn*2 + 'x',
i = _.attr('data-mainimage').replace('respimgsize', w),
i2 = _.attr('data-mainimage').replace('respimgsize', w2),
attr = _.attr('data-mainimageratio');
_.attr('data-srcset', i+' 1x,'+i2+' 2x').attr('srcset', i+' 1x,'+i2+' 2x');
if(!$('#same_product_height').length) {
var h = wn/Number(attr);
_.parent().css('height', h).css('display', 'block');
}
})
}, 100);
alignmentArrowValue();
}
function getTabcontent(a, mobilegrid){
if(!a.length || !a.hasClass('startajax')) return false;
a.removeClass('startajax')
var url = '/collections/all?view=collectiontabshorizontal&constraint=' + a.attr('data-content'),
params = {
type: "get",
url: url,
success: function(data){
var check = !$('.tt-product .tt-product-inside-hover').length ? true : false;
var check2 = !$('.product-parent').length ? true : false;
var p = a.parent();
a.replaceWith(data);
if(a.hasClass('slider')){
p.find('.tt-carousel-products-js').initSlick(3, 2, mobilegrid);
alignmentArrowValue();
if($(".tt-rating").length > 0) {
try {
$.getScript(window.location.protocol + "//productreviews.shopifycdn.com/assets/v4/spr.js");
} catch (err) {}
}
}
initImagesSize();
lazyload();
$('body').trigger('refreshCurrency');
ttProductSmall();
countDown(true);
setTimeout(ttReinitflowProduct, 0);
if($('.tt-product .tt-product-inside-hover').length && check){
ttProductHover();
}
if($('.product-parent').length && check2){
wl_handler.init();
compare.init();
}
}
}
jQuery.ajax(params);
}
$.fn.initProductPageRecommendations = function() {
var productId = this.attr('data-product-id'),
title = this.attr('data-title'),
limit = this.attr('data-limit'),
titleposition = this.attr('data-titleposition'),
fullscreen = this.attr('data-fullscreen'),
slickshow = this.attr('data-slickshow'),
recommendationsSectionUrl =
'/recommendations/products?§ion_id=product-recommendations&product_id=' +
productId +
'&limit='+limit;
$.get(recommendationsSectionUrl).then(
function(section) {
var recommendationsMarkup = $(section).html();
if (recommendationsMarkup.trim() !== '') {
this.html(recommendationsMarkup);
lazyload();
this.find('.tt-title-small').html(title).parent().addClass(titleposition);
fullscreen == "true" && this.find('.tt-block-title').parent().removeClass('container').addClass('container-fluid-custom');
this.find('.tt-carousel-products').attr('data-slick', '{"slidesToShow": '+slickshow+', "slidesToScroll": '+slickshow+'}').initSlick(3, 2, 2);
alignmentArrowValue();
initImagesSize();
}
}.bind(this)
);
}
$.fn.initSigleTextWithIcon = function() {
var $singletextwithicons = this;
sigleTextWithIconHandler();
$(window).resize(sigleTextWithIconHandler);
function sigleTextWithIconHandler(){
$(window).width() > 1024 ? unslickSigleTextWithIcon() : initSlickSigleTextWithIcon();
}
function initSlickSigleTextWithIcon(){
if($singletextwithicons.hasClass('slick-slider')) return false;
$singletextwithicons.slick({
dots: false,
arrows: false,
infinite: true,
adaptiveHeight: true,
slidesToShow: 6,
slidesToScroll: 1,
responsive:
[
{
breakpoint: 1025,
settings: {
slidesToShow: 2,
slidesToScroll: 1
}
},
{
breakpoint: 500,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
]
});
}
function unslickSigleTextWithIcon(){
if(!$singletextwithicons.hasClass('slick-slider')) return false;
setTimeout(function(){$singletextwithicons.slick('unslick');}, 200);
}
}
$.fn.initSlick = function(md, sm, xs,adaheight) {
adaheight = adaheight == false ? false : true;
this.slick({
dots: false,
arrows: true,
infinite: true,
adaptiveHeight: adaheight,
responsive:
[
{
breakpoint: 1025,
settings: {
slidesToShow: md,
slidesToScroll: md
}
},
{
breakpoint: 769,
settings: {
slidesToShow: sm,
slidesToScroll: sm
}
},
{
breakpoint: 480,
settings: {
slidesToShow: xs,
slidesToScroll: xs
}
}
]
});
}
$.fn.initSlickBrands = function(md, sm, sm2, xs, xs2) {
this.slick({
dots: false,
arrows: true,
infinite: true,
adaptiveHeight: true,
responsive: [
{
breakpoint: 1230,
settings: {
slidesToShow: md,
slidesToScroll: md
}
},
{
breakpoint: 1025,
settings: {
slidesToShow: sm,
slidesToScroll: sm
}
},
{
breakpoint: 790,
settings: {
slidesToShow: sm2,
slidesToScroll: sm2
}
},
{
breakpoint: 576,
settings: {
slidesToShow: xs,
slidesToScroll: xs
}
},
{
breakpoint: 380,
settings: {
slidesToShow: xs2,
slidesToScroll: xs2
}
}
]
});
};
// carusel
$.fn.initSlickLookbook = function(md, sm, xs) {
this.slick({
dots: true,
arrows: true,
infinite: true,
adaptiveHeight: true,
responsive:
[
{
breakpoint: 1025,
settings: {
slidesToShow: sm,
slidesToScroll: sm
}
},
{
breakpoint: 790,
settings: {
slidesToShow: xs,
slidesToScroll: xs
}
}
]
});
};
$.fn.initMasonryLookbook = function() {
if($('body').find('.isotope_included').length == 0)
{
this.replaceWith('Save and reload page.');
return false;
}
var _ = this;
var iso = _.isotope({
itemSelector: '.element-item',
layoutMode: 'masonry',
gutter: 0
});
// layout Isotope after each image loads
iso.imagesLoaded().progress( function(index) {
iso.addClass('tt-show').isotope('layout');
});
}
$.fn.blurbsreviewMasonry = function() {
if(!this.length) return false;
var _this = this
var isActive = false;
brmHandler();
$(window).bind('resize', brmHandler);
function brmHandler(){
if($(window).width() < 576){
if (isActive){
_this.removeClass('tt-show').isotope('destroy');
isActive = false;
}
}
else{
if (!isActive){
_this.initMasonryLookbook();
isActive = true;
}
}
}
}
//REVOLUTION SLIDER (function to reset the plug on the breakpoints)
$.fn.initRevolution = function(){
if($('body').find('.revolution_included').length == 0)
{
this.replaceWith('Save and reload page.');
return false;
}
function click_to_play_video() {
var $this = $(this),
$video = $this.find('li video');
if (!$video.length) return;
$video.on('play', function() {
var $btn = $(this).parents('li').find('.video-play');
$btn.addClass('pause');
$(this).parents('.tp-caption.fullscreenvideo').addClass('click-video');
});
$video.on('pause ended', function() {
var $btn = $(this).parents('li').find('.video-play');
$btn.removeClass('pause');
});
$this.find('.video-play').on('click', function(e) {
var $video = $(this).parents('li').find('video');
$video.trigger('click');
e.preventDefault();
e.stopPropagation();
return false;
});
$this.on('revolution.slide.onbeforeswap', function(event, data) {
$(this).find('.tp-caption.fullscreenvideo').removeClass('click-video');
});
};
function autoplay_video(elem) {
var $get_sliders = $(this);
$get_sliders.each(function() {
var $slider = $(this);
var set_event = function() {
$slider.on('revolution.slide.onchange', function(event, data) {
var $this = $(this),
$active_slide = $this.find('li').eq(data.slideIndex - 1),
$video = $active_slide.find('video'),
autoplay = $active_slide.find('.tp-caption').attr('data-autoplay');
if ($video.length && autoplay === 'true') {
var video = $video.get(0);
video.currentTime = 0;
$slider.one('revolution.slide.onafterswap', function(event, data) {
if (video.paused) {
video.play();
}
});
}
});
};
if ($slider.hasClass('revslider-initialised')) {
set_event();
} else {
$slider.one('revolution.slide.onloaded', function() {
set_event();
});
}
});
};
$.fn.resizeRevolution = function(options, new_rev_obj, bp_arr, revdelay) {
if (!$(this).length || !$(options.slider).length || !options.breakpoints) return false;
var wrapper = this,
slider = options.slider,
breakpoints = options.breakpoints,
fullscreen_BP = options.fullscreen_BP || false,
new_rev_obj = new_rev_obj || {},
bp_arr = bp_arr || [],
rev_obj = {
dottedOverlay: "none",
delay: revdelay,
startwidth: 1920,
hideThumbs: 200,
hideTimerBar: "on",
thumbWidth: 100,
thumbHeight: 50,
thumbAmount: 5,
navigationArrows: "none",
touchenabled: "on",
onHoverStop: "on",
swipe_velocity: 0.7,
swipe_min_touches: 1,
swipe_max_touches: 1,
drag_block_vertical: false,
parallax: "mouse",
parallaxBgFreeze: "on",
parallaxLevels: [7, 4, 3, 2, 5, 4, 3, 2, 1, 0],
keyboardNavigation: "off",
navigationHAlign: "center",
navigationVAlign: "bottom",
navigationHOffset: 0,
navigationVOffset: 20,
soloArrowLeftHalign: "left",
soloArrowLeftValign: "center",
soloArrowLeftHOffset: 20,
soloArrowLeftVOffset: 0,
soloArrowRightHalign: "right",
soloArrowRightValign: "center",
soloArrowRightHOffset: 20,
soloArrowRightVOffset: 0,
shadow: 0,
spinner: "",
h_align: "left",
stopLoop: "off",
stopAfterLoops: -1,
stopAtSlide: -1,
shuffle: "off",
autoHeight: "off",
forceFullWidth: "off",
hideThumbsOnMobile: "off",
hideNavDelayOnMobile: 1500,
hideBulletsOnMobile: "off",
hideArrowsOnMobile: "off",
hideThumbsUnderResolution: 0,
hideSliderAtLimit: 0,
hideCaptionAtLimit: 0,
hideAllCaptionAtLilmit: 0,
startWithSlide: 0,
fullScreenOffsetContainer: ""
};
$.extend(rev_obj, new_rev_obj);
var get_Slider = function($sliderWrapp) {
return $sliderWrapp.find(slider);
};
var get_current_bp = function() {
var wind_W = window.innerWidth;
for (var i = 0; i < breakpoints.length; i++) {
var bp = breakpoints[i];
if (!breakpoints.length) return false;
if (wind_W <= bp) {
if (i === 0) {
return bp;
} else {
if (bp > breakpoints[i - 1])
return bp;
}
} else if (wind_W > bp && i === breakpoints.length - 1)
return Infinity;
}
return false;
};
var $sliderWrappers = $(wrapper);
$sliderWrappers.each(function() {
var $sliderWrapp = $(this),
$sliderInit = get_Slider($sliderWrapp),
$sliderCopy = $sliderWrapp.clone(),
bp = get_current_bp();
if (!$sliderInit.length) return false;
var start_Rev = function($sliderInit, bp) {
var wind_W = window.innerWidth,
rev_settings_obj = {},
rev_screen_obj = {},
set_rev_obj = {};
if (fullscreen_BP) {
var full_width = (wind_W >= fullscreen_BP) ? 'off' : 'on',
full_screen = (wind_W >= fullscreen_BP) ? 'on' : 'off';
rev_screen_obj = {
fullWidth: full_width,
fullScreen: full_screen
};
}
if (bp_arr.length) {
for (var i = 0; i < bp_arr.length; i++) {
var this_obj = bp_arr[i];
if (this_obj.bp && this_obj.bp.length === 2 && this_obj.bp[0] < this_obj.bp[1]) {
var from = this_obj.bp[0],
to = this_obj.bp[1];
if (from <= bp && to >= bp) {
for (var key in this_obj) {
if (key !== 'bp')
rev_settings_obj[key] = this_obj[key];
}
}
}
}
}
$.extend(set_rev_obj, rev_obj, rev_settings_obj, rev_screen_obj);
$($sliderInit).show().revolution(set_rev_obj);
$(options.functions).each(function() {
this.call($sliderInit);
});
};
start_Rev($sliderInit, bp);
var restart_Rev = function(current_bp) {
if (!$($sliderInit).hasClass('revslider-initialised')) return;
bp = current_bp || 0;
$sliderInit.revkill();
$sliderWrapp.replaceWith($sliderCopy);
$sliderWrapp = $sliderCopy;
$sliderCopy = $sliderWrapp.clone();
$sliderInit = get_Slider($sliderWrapp);
start_Rev($sliderInit, bp);
};
function endResize(func) {
var windWidth = window.innerWidth,
interval;
interval = setInterval(function() {
var windWidthInterval = window.innerWidth;
if (windWidth === windWidthInterval) {
setTimeout(function() {
func();
}, 200);
}
clearInterval(interval);
}, 100);
};
$(window).on('resize', function() {
endResize(function() {
var current_bp = get_current_bp();
if (current_bp !== bp)
restart_Rev(current_bp);
})
});
});
};
var delay = this.data('speed'),
fullscreen = this.attr('data-fullscreen') == 'false' ? false : 768,
width = this.attr('data-width'),
height = this.attr('data-height');
if(this.hasClass('revolution-default')) {
this.resizeRevolution(
{
slider: '.tp-banner',
breakpoints: [414, 767, 1025],
fullscreen_BP: fullscreen,
functions: [
click_to_play_video,
autoplay_video
]
},
{
fullScreenOffsetContainer: "header",
navigationArrows: "true",
startwidth: width || 1920,
startheight: height || 800
},
[
{
bp: [0, 768],
startheight: height || 1200
}
],
delay
);
}
else {
this.resizeRevolution(
{
slider: '.tp-banner',
breakpoints: [414, 767, 1025],
fullscreen_BP: fullscreen,
functions: [
click_to_play_video,
autoplay_video
]
},
{
fullScreenOffsetContainer: "header-static",
startwidth: width || 1920,
startheight: height || 800
},
[
{
bp: [0, 768],
startheight: height || 1200
},
{
bp: [0, 1025],
fullScreenOffsetContainer: "header"
}
],
delay
);
}
}
$('body').on(
'click', '.tt-review, .tt-rating', function(e){
if($("[data-ali]").length) {
alireviewApp($("[data-ali]").attr('data-ali'));
return false;
}
if($(this).closest('.tt-review').length) {
$('#tab_review').length && findAndViewReviews();
}
else{
window.location = $(this).closest('.tt-rating').data('url') + '?tab_review';
}
}
)
function alireviewApp(val){
var $id = '#'+val;
var y = $($id).offset().top;
var d = $('.tt-stuck-nav').length && $('.tt-stuck-nav.disabled').length == 0 ? $('.tt-stuck-nav').height() : 0;
$('html, body').animate({
scrollTop: y-d*2
}, 500);
}
$(document).ready(function() {
var s = window.location.search;
if($("[data-ali]").length && s.indexOf('tab_review') > -1){
setTimeout(function(){alireviewApp($("[data-ali]").attr('data-ali'))}, 2000);
return false;
}
if(s.indexOf('tab_review') == -1 || $('#tab_review').length == 0) return false;
setTimeout(findAndViewReviews, 2000);
});
function findAndViewReviews(){
var y = $('#tab_review').offset().top;
var d = $('.tt-stuck-nav').length && $('.tt-stuck-nav.disabled').length == 0 ? $('.tt-stuck-nav').height() : 0;
$('html, body').animate({
scrollTop: y-d
}, 500);
if($('#tab_review').hasClass('nav-link')){
$('#tab_review').trigger('click');
}
else{
!$('#tab_review').hasClass('active') && $('#tab_review').find('.tt-collapse-title').trigger('click');
}
}
/* Search autocomplite */
$(function() {
// Current Ajax request.
var currentAjaxRequest = null;
// Grabbing all search forms on the page, and adding a .search-results list to each.
var searchForms = $('form[action*="/search"]').each(function() {
// Grabbing text input.
var input = $(this).find('input[name="q"]');
// Adding a list for showing search results.
var offSet = input.position().top + input.innerHeight() + 1;
$('').appendTo($(this)).hide();
// Listening to keyup and change on the text field within these search forms.
input.attr('autocomplete', 'off').bind('keyup change', function() {
// What's the search term?
var term = $(this).val();
// What's the search form?
var form = $(this).closest('form');
// What's the search URL?
var searchURL = '/search?type=product&q=' + term;
// What's the search results list?
var resultsList = form.find('.search-results');
// If that's a new term and it contains at least 3 characters.
if (term.length > 3 && term != $(this).attr('data-old-term')) {
// Saving old query.
$(this).attr('data-old-term', term);
// Killing any Ajax request that's currently being processed.
if (currentAjaxRequest != null) currentAjaxRequest.abort();
// Pulling results.
currentAjaxRequest = $.getJSON(searchURL + '&view=json', function(data) {
// Reset results.
resultsList.empty();
// If we have no results.
if(data.results_count == 0) {
resultsList.hide();
} else {
var resultsList_ul = resultsList.append('
');
resultsList_ul = resultsList_ul.find('ul');
// If we have results.
$.each(data.results, function(index, item) {
if(index >= 6) return false;
var link = $('').attr('href', item.url);
link.append('
');
link.append('
' + item.title + '
');
link.wrap('');
resultsList_ul.append(link.parent());
});
// The Ajax request will return at the most 10 results.
// If there are more than 10, let's link to the search results page.
if(data.results_count > 6) {
resultsList.append('