// JQuery var jQ = jQuery.noConflict(); jQ(document).ready(function() { ///// GENERAL SITEWIDE JS var Mediabox = ''; //set path's if VSM or live var loc = window.location; vsmURL = loc.protocol + '//' + loc.hostname + '/'; if (vsmURL.indexOf('vsmtools') > -1 ) { vsmURL = vsmURL + 'U/575/'; } else { vsmURL = ''; } var vars = [], hash; var q = document.URL.split('?')[1]; if(q != undefined){ q = q.split('&'); for(var i = 0; i < q.length; i++){ hash = q[i].split('='); vars.push(hash[1]); vars[hash[0]] = hash[1]; } } // Stick Nav Header jQ(window).scroll(function() { if (jQ(this).scrollTop() > 1){ jQ("body").addClass('stuck'); } else { jQ("body").removeClass('stuck'); } if (jQ(this).scrollTop() > 500){ jQ("body").addClass('stuck2'); } else { jQ("body").removeClass('stuck2'); } }); // add classes to body for specific page // add name of current selected nav page class to body jQ("nav a.selected").each (function () { var currentPage = jQ(this).text().toLowerCase().replace(/(^\s+|[^a-zA-Z0-9 ]+|\s+$)/g,"").replace(/\s+/g, "-"); jQ('body').addClass(currentPage); }); // add name of current page title class to body var currentPageTitle = jQ("h1.pagename").text().toLowerCase().replace(/(^\s+|[^a-zA-Z0-9 ]+|\s+$)/g,"").replace(/\s+/g, "-"); // add id of current page as well (sicne this doesn't change) var currentPageID = jQ('#divNavPath').attr('class'); jQ('body').addClass(currentPageTitle + ' page'+currentPageID); // Hide 'No Product' Display message if no products if (!jQ('.product-wrap .product-item').length) { jQ('.product-wrap').remove(); } ///// HOME JS if (jQ('body.page-home').length) { // Home Slider // Clean out inputs within VSM generated gallery jQ('.home-slider input').remove(); var homeSlider = jQ(".home-slider"); // set slider imag as background jQ('.home-slider .gal-image-wrap').each (function (){ var imgSRC = jQ(this).find('img').attr('src'); jQ(this).css('background-image', 'url('+ imgSRC +')'); jQ(this).find('img').remove(); }); //jQ('.galDescription').wrap("
"); homeSlider.owlCarousel({ items:1, dots:true, nav:false, animateIn:'fadeIn', animateOut:'fadeOut', lazyLoad:true, margin:0, loop:false, autoplay:true, autoplayTimeout:8000, autoplayHoverPause:false, smartSpeed:450, responsiveRefreshRate:0 }); // Home Product Slider jQ('.product-wrap input, .product-wrap script, .ecomPag').remove(); var homeProdSlider = jQ(".product-wrap"); homeProdSlider.owlCarousel({ items:6, itemElement: 'a', dots:false, nav:false, lazyLoad:true, margin:10, loop:true, checkVisible:false, autoplay:true, autoplayTimeout:5000, autoplayHoverPause:false, smartSpeed:450, responsiveRefreshRate:0, responsive : { 0 : { items:1 }, 400 : { items:2 }, 600 : { items:3 }, 800 : { items:4 }, 1200 : { items:6 }, 1800 : { items:8 } } }); // Set Size of SLider Circle //var sliderHeight = jQ('.slider-text').outerHeight() + 50; //jQ('.slider-text').css('height', sliderHeight); //jQ('.slider-text').css('width', sliderHeight); } ///// STATIC PAGES JS if (jQ('body.page-pages').length) { // Set Hero Image to Background if (jQ('.hero-base').attr('data-pageicon').contains(".jpg") || jQ('.hero-base').attr('data-pageicon').contains(".JPG")) { var pageiconImage = jQ('.hero-base').attr('data-pageicon'); console.log(pageiconImage); jQ('.hero-base').css('background-image', 'url(' + pageiconImage + ')'); } // Has no sub nav then make full width if (!jQ('.sub-nav .l2').length) { jQ('.main').attr('class', 'main'); jQ('.sub-nav').remove(); } // Product details page if (jQ('.product-details-wrap').length) { // Increment & Decrement jQ('.plus-button').click(function() { var $input = jQ('.product-qty input'); var value = parseInt($input.val()); value = value + 1; $input.val(value); }); jQ('.minus-button').click(function() { var $input = jQ('.product-qty input'); var value = parseInt($input.val()); if (value > 1) { value = value - 1; } else { value = 1; } $input.val(value); }); // Set product images as backgrounds if (jQ('.item-image').length) { jQ('.item-image').each (function (){ var imgSRC = jQ(this).find('img').attr('src'); // if no image if (imgSRC == null) { jQ(this).css('background-image', 'url(https://dummyimage.com/600x600/fff/000.png&text=Image+Coming+Soon)'); } else { jQ(this).css('background-image', 'url('+ encodeURI(imgSRC) +')'); jQ(this).attr('data-path', encodeURI(imgSRC)); jQ(this).find('img:not(.thumb-prodImage)').remove(); } }); } // when add to cart button is clicked set sessionStorage vars for added alert jQ('input[name="btnAddtoCartS"]').click(function() { sessionStorage.setItem("prodName", jQ('.product-top .product-name').html()); }); if (sessionStorage.getItem('prodName')) { var prodName = sessionStorage.getItem('prodName'); jQ('.content-wrap').prepend('
The following has been added to your cart,

'+prodName+'

Continue Shopping View Cart
'); jQ('#overlay').delay(500).slideDown(); sessionStorage.removeItem("prodName"); jQ('#overlay').click(function(){ jQ(this).slideUp(); }); } // Clean/Update Lightbox & thumbnail area on Details Page // remove old pop-up links jQ('.prod-right .details-mainImg-Wrap').remove(); // create new row for thumbs jQ('.item-image-details').after('
'); // if has thumbnails, put in a new container. if (jQ('.thumb-prodImage').length) { var prodThumbs = jQ('.item-image-details').html(); jQ('.prod-thumbs-wrap').html(prodThumbs); jQ('.item-image-details').empty(); jQ('.prod-thumbs-wrap img').each(function() { var imgSRC = jQ(this).attr('src'); jQ(this).wrap('
'); jQ(this).remove(); }); } else { // only one product image var imgSRC = jQ('.item-image-details').attr('data-path'); jQ('.prod-thumbs-wrap').html('
'); } // Image Zoom on Hover function imgZoom() { if(!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { jQ('.item-image-details') .on('mouseover', function(){ jQ(this).children('.photo').css({'transform': 'scale(2.4)'}); }) .on('mouseout', function(){ jQ(this).children('.photo').css({'transform': 'scale(1)'}); }) .on('mousemove', function(e){ jQ(this).children('.photo').css({'transform-origin': ((e.pageX - jQ(this).offset().left) / jQ(this).width()) * 100 + '% ' + ((e.pageY - jQ(this).offset().top) / jQ(this).height()) * 100 +'%'}); }); jQ('.item-image-details').append('
').children('.photo').css({'background-image': 'url('+ jQ('.item-image-details').attr('data-path') +')'}) } } imgZoom(); // Update Large image with thumbs jQ('.thumb-image').click(function() { var thumbImgSRC = jQ(this).attr('data-path'); jQ('.item-image-details').attr('data-path', encodeURI(thumbImgSRC)); jQ('.item-image-details').css('background-image', 'url('+ encodeURI(thumbImgSRC) +')'); jQ('.item-image-details').removeClass('has-video'); jQ('.item-image-details').empty(); jQ('.thumb-image').removeClass('thumb-selected'); jQ(this).toggleClass('thumb-selected'); imgZoom(); }); // show popup on main image click jQ('.item-image-details').on('click', function() { function showPopUp () { jQ('.product-image-area').wrapInner('