/*********************************************************************************
Template Name: Genrre - Fashion eCommerce Bootstrap4 Template
Description: A perfect template to build beautiful and unique fashion eCommerce websites. It comes with nice and clean design.
Version: 1.1
Note: This is main js.
**********************************************************************************/
/**************************************************************
STYLESHEET INDEXING
|
|
|___ Sticky Header
|___ Hero Area Slider Active
|___ Gallery Blog Slider Active
|___ Brand Logo Slider Active
|___ Similliar Products Slider Active
|___ Product Details Images
|___ Nice Select Activation
|___ Banner Masonry Activaiton
|___ Bootstrap4 Tooltip Active
|___ Mobile Menu
|___ Shop Product View Toogler
|___ Product Quantity
|___ Product Detals Color & Size
|___ Product Popup
|___ Quick View Modal
|___ Rating Hover Action
|___ Range Slider Active
|___ Tags Cloud
|___ Progress Bar Effect
|___ Checkout Login Coupon
|___ Different Address Form
|
|
|___ END STYLESHEET INDEXING
***************************************************************/
(function ($) {
'use strict';
// let links = document.getElementsByTagName('link');
// for (let i = 0; i < links.length; i++) {
// if (links[i].getAttribute('rel') == 'stylesheet') {
// let href = links[i].getAttribute('href')
// .split('?')[0];
//
// let newHref = href + '?version='
// + new Date().getMilliseconds();
//
// links[i].setAttribute('href', newHref);
// }
// }
//var h, a, f;
// a = document.getElementsByTagName('link');
// for (h = 0; h < a.length; h++) {
// f = a[h];
// if (f.rel.toLowerCase().match(/stylesheet/) && f.href) {
// var g = f.href.replace(/(&|\?)rnd=\d+/, '');
// f.href = g + (g.match(/\?/) ? '&' : '?');
// f.href += 'rnd=' + (new Date().valueOf());
// }
// }
/* Sticky Header */
$(window).on('scroll', function () {
var scrollPos = $(this).scrollTop();
if (scrollPos > 300) {
$('.sticky-header').addClass('is-sticky');
} else {
$('.sticky-header').removeClass('is-sticky');
}
});
/* Hero Area Slider Active */
$('.hero-area').slick({
slidesToShow: 1,
autoplay: true,
autoplaySpeed: 8000,
adaptiveHeight: true,
dots: false,
arrows: true,
fade: true,
easing: 'ease-in-out',
speed: 1000,
prevArrow: '',
nextArrow: '',
});
/* Gallery Blog Slider Active */
$('.blog-item-gallery').slick({
slidesToShow: 1,
autoplay: true,
autoplaySpeed: 8000,
adaptiveHeight: true,
dots: false,
arrows: true,
fade: true,
easing: 'ease-in-out',
speed: 1000,
prevArrow: '',
nextArrow: '',
});
/* Brand Logo Slider Active */
$('.brand-logos').slick({
slidesToShow: 4,
autoplay: true,
autoplaySpeed: 5000,
dots: false,
arrows: true,
easing: 'ease-in-out',
prevArrow: '',
nextArrow: '',
responsive: [{
breakpoint: 992,
settings: {
slidesToShow: 3,
slidesToScroll: 1
}
},
{
breakpoint: 768,
settings: {
slidesToShow: 2,
slidesToScroll: 1
}
},
{
breakpoint: 450,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}]
});
/* Similliar Products Slider Active */
$('.similliar-products-slider-active').slick({
slidesToShow: 4,
autoplay: true,
autoplaySpeed: 5000,
dots: false,
arrows: true,
easing: 'ease-in-out',
prevArrow: '',
nextArrow: '',
responsive: [{
breakpoint: 1200,
settings: {
slidesToShow: 3,
slidesToScroll: 1
}
},
{
breakpoint: 992,
settings: {
slidesToShow: 2,
slidesToScroll: 1
}
},
{
breakpoint: 576,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}]
});
/* Product Details Images */
$('.product-details-images').slick({
slidesToShow: 1,
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 5000,
dots: false,
infinite: true,
centerMode: true,
centerPadding: 0,
prevArrow: '',
nextArrow: '',
asNavFor: '.product-details-thumbs'
});
$('.product-details-thumbs').slick({
slidesToShow: 3,
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 5000,
dots: false,
infinite: true,
focusOnSelect: true,
centerMode: true,
centerPadding: 0,
prevArrow: '',
nextArrow: '',
asNavFor: '.product-details-images'
});
/* Nice Select Activation */
$('select').niceSelect();
/* Banner Masonry Activaiton */
$('.banners-masonry-active').imagesLoaded(function () {
$('.banners-masonry-active').masonry({
itemSelector: '.masonry-item',
columnWidth: 1
});
});
/* Mobile Menu */
$('nav.sn-navigation').meanmenu({
meanMenuClose: '
',
meanMenuCloseSize: '18px',
meanScreenWidth: '991',
meanExpandableChildren: true,
meanMenuContainer: '.mobile-menu',
onePage: true
});
/* Shop Product View Toogler */
$('.shop-toolbar-changeview button').on('click', function () {
changeview($(this).data('product-view'));
// if ($(this).data('product-view') == 'list') {
// $('.shop-toolbar-changeview button[data-product-view="list"]').addClass('active').siblings().removeClass('active');
// $('.shop-page-products').addClass('active-list-view').removeClass('active-grid-view');
// setCookie('view','list',7);
// } else {
// $('.shop-toolbar-changeview button[data-product-view="grid"]').addClass('active').siblings().removeClass('active');
// $('.shop-page-products').addClass('active-grid-view').removeClass('active-list-view');
// setCookie('view','grid',7);
// }
});
function changeview(style) {
if (style == 'list') {
$('.shop-toolbar-changeview button[data-product-view="list"]').addClass('active').siblings().removeClass('active');
$('.shop-page-products').addClass('active-list-view').removeClass('active-grid-view');
setCookie('view', 'list', 7);
} else {
$('.shop-toolbar-changeview button[data-product-view="grid"]').addClass('active').siblings().removeClass('active');
$('.shop-page-products').addClass('active-grid-view').removeClass('active-list-view');
setCookie('view', 'grid', 7);
}
}
var x = getCookie('view');
//alert(x)
if (x) {
changeview(x);
}
function setCookie(name, value, days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
}
function getCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ')
c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0)
return c.substring(nameEQ.length, c.length);
}
return null;
}
function eraseCookie(name) {
document.cookie = name + '=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
}
/* Product Quantity */
$('.quantity-select').append('