$(document).ready(function() { $('.menu-icon').click(function() { $('.wrapper').addClass('hamburger-menu'); }); $('.nav-navigation-close').click(function(e) { e.preventDefault(); $('.wrapper').removeClass('hamburger-menu'); }); //mobile filter $('.toggle-open').click(function(e) { e.preventDefault(); if ($('.mobile-fixed').hasClass('filter-out')) { $('.mobile-fixed').removeClass('filter-out'); $('.toggle-open').removeClass('filter-open'); } else { $('.mobile-fixed').addClass('filter-out'); $('.toggle-open').addClass('filter-open'); } }); if ($('.search-form-wrap').length) { var barOffset = $('.search-form-wrap').offset().top - 80; $(window).scroll(function() { if($(window).scrollTop() > barOffset) { $('.wrapper').addClass('is-sticky'); } if ($(window).scrollTop() > 20) { $('.wrapper').addClass('bg-blck'); } else { $('.wrapper').removeClass('is-sticky'); $('.wrapper').removeClass('bg-blck') } }); } if ($('.header-fixed-wo-search').length) { var barOffset = 0; $(window).scroll(function() { if ($(window).scrollTop() > barOffset) { $('.wrapper').addClass('is-sticky'); } else { $('.wrapper').removeClass('is-sticky'); } }); } if ($('.select').length) { $(".select").selectbox(); } if ($('.owl-carousel').length) { $('.owl-carousel').owlCarousel({ loop : true, nav : true, responsive : { 0 : { items : 1 }, 600 : { items : 3 }, 1000 : { items : 5 } } }) } // // KW - Commented out and moved to 'productoverview' // //if ($('.pro-product-slider-wrap').length) { // $('.pro-product-slider').slick({ // slidesToShow : 1, // slidesToScroll : 1, // arrows : false, // fade : true, // asNavFor : '.pro-product-slider-thumb' // }); // $('.pro-product-slider-thumb').slick({ // slidesToShow : 5, // slidesToScroll : 1, // asNavFor : '.pro-product-slider', // centerMode : true, // focusOnSelect : true, // vertical : true, // verticalSwiping : true, // arrows : false // }); //} // ======Custom scrollbar Gallery =============== if ($('.custom-scroll-section').length) { $(".custom-scroll-section").mCustomScrollbar({ }); } $('.tr-category-wrap .tr-category .tr-icon-arrow').click(function(e) { e.preventDefault(); $(this) .closest('.tr-category') .toggleClass('active'); $(this) .closest('.tr-category-wrap') .find('.tr-toggle-content') .slideToggle("slow"); }); $('.ci-block-ship-top').click(function(e) { e.preventDefault(); $(this).toggleClass('active').parent('.ci-block-ship-content').children('.ci-block-ship-bottom').slideToggle("slow"); }); $('.pm-card-date .icon-bottom-arrow').click(function() { $(this).toggleClass('active').closest('.pm-method-content').children('.sa-add-btn').slideToggle("slow"); }); /*$('.rv-billing-change').click(function(e){ $('.popup-type-billing').fadeIn(); });*/ //$('.rv-ship-info .rv-change-01').click(function() { // $('.pu-wrapper-01').fadeIn(500); //}); $('.close-shipping').click(function() { $('.pu-wrapper-01').fadeOut(500); }); //$('.ba-add-billing').click(function() { // $('.pu-wrapper-01').fadeOut(); // $('.pu-wrapper-02').fadeIn(); //}); $('.close-new-shipping').click(function() { $('.pu-wrapper-02').fadeOut(500); }); /*$('.new-card').click(function() { $('.pu-wrapper-03').fadeIn(500); $('.pu-wrapper').fadeOut(500); });*/ $('.cp-pay-btn .btn').click(function(e){ $('.pu-wrapper').fadeOut(500); e.preventDefault(); }); $('.close-new-payment').click(function() { $('.pu-wrapper-03').fadeOut(500); }); $('.add-review').click(function() { $('.pu-wrapper-04').fadeIn(500); }); $('.close-review').click(function() { $('.pu-wrapper-04').fadeOut(500); }); $('.leave-checkout').click(function() { $('.pu-wrapper-08').fadeIn(500); }); $('.close-leave-checkout').click(function() { $('.pu-wrapper-08').fadeOut(500); }); $('.hp-load-more').click(function() { $('.hp-load-more').toggle(); $('.more-featured').fadeIn(500); }); //===============Account Page options =========== $('#accountsidebar .acc-option').click(function(e) { e.preventDefault(); // // Update the link // $('.acc-option.active').removeClass('active'); $(this).addClass('active'); // // Update the pane/content itself // $('.account-tab').removeClass('active'); var tabname = $(this).attr('data-view'); $('.account-tab.account-'+tabname).addClass('active'); if(tabname == 'orders'){ $('.acc-order-receipt').hide(); $('.account-orders .ro-content').show(); } /*if ($('.your-account').hasClass('active')) { $('.acc-block').fadeOut(200); $('.acc-user-details').fadeIn(500); } else if ($('.order-history').hasClass('active')) { $('.acc-block').fadeOut(200); $('.ro-content').fadeIn(500); } else if ($('.payment-methods').hasClass('active')) { $('.acc-block').fadeOut(200); $('.pay-meth').fadeIn(500); } else if ($('.acc-address').hasClass('active')) { $('.acc-block').fadeOut(200); $('.acc-address').fadeIn(500); } else { $('.acc-block').fadeOut(200); }*/ }); $('.chk-recent-order-link').click(function(e) { e.preventDefault(); $('.acc-order-receipt').toggle(); $('.ro-content').fadeIn(500); }); $('.edit-add').click(function(e) { e.preventDefault(); $('.pu-wrapper-02').fadeIn(500); }); $('.close-new-shipping').click(function(e) { e.preventDefault(); $('.pu-wrapper-02').fadeOut(500); }); $('.del-add').click(function(e) { e.preventDefault(); $('.pu-wrapper-05').fadeIn(500); }); $('.close-del-address').click(function(e) { e.preventDefault(); $('.pu-wrapper-05').fadeOut(500); }); $('.add-del-no').click(function(e) { e.preventDefault(); $('.pu-wrapper-05').fadeOut(500); }); $('.del-pay').click(function(e) { e.preventDefault(); $('.pu-wrapper-06').fadeIn(500); }); $('.close-del-payment').click(function(e) { e.preventDefault(); $('.pu-wrapper-06').fadeOut(500); }); $('.pay-del-no').click(function(e) { e.preventDefault(); $('.pu-wrapper-06').fadeOut(500); }); $('.edit-pay').click(function(e) { e.preventDefault(); $('.pu-wrapper-07').fadeIn(500); }); $('.close-edit-payment').click(function(e) { e.preventDefault(); $('.pu-wrapper-07').fadeOut(500); }); $('.pay-edit-no').click(function(e) { e.preventDefault(); $('.pu-wrapper-07').fadeOut(500); }); //user-info-account $('.acc-full-name .acc-edit').click(function(e) { e.preventDefault(); $('.current-details').toggle(); $('.acc-edit-details.edit-name').fadeIn(200); }); $('.back-to-account').click(function(e) { e.preventDefault(); $('.acc-edit-details').fadeOut(5); $('.current-details').fadeIn(200); }); $('.acc-alias .acc-edit').click(function(e) { e.preventDefault(); $('.current-details').toggle(); $('.acc-edit-details.edit-alias').fadeIn(200); }); $('.acc-phone .acc-edit').click(function(e) { e.preventDefault(); $('.current-details').toggle(); $('.acc-edit-details.edit-phone').fadeIn(200); }); $('.acc-email .acc-edit').click(function(e) { e.preventDefault(); $('.current-details').toggle(); $('.acc-edit-details.edit-email').fadeIn(200); }); $('.current-password-wrap .acc-edit').click(function(e) { e.preventDefault(); $('.current-details').toggle(); $('.acc-edit-details.edit-password').fadeIn(200); }); // upload images $('.upload-img').click(function(e) { e.preventDefault(); $('.acc-photo-upload').toggle(); $('.acc-drop-file').fadeIn(200); }); //stars for add review if($('.star-rating').length){ $('.star-rating').starrr({ change: function(e, value){ if (value) { $('.your-choice-was').show(); $('.choice').text(value); } else { $('.your-choice-was').hide(); } } }); } //filter all category $('.all-cats').click(function(e) { e.preventDefault(); $('.view-all-box').fadeIn(500); }); $('.btn-action-vote').on('click', function(e){ e.preventDefault(); var parent = $(this).closest('.voteable'); var ident = $(parent).attr('data-ident'); var decision = $(this).attr('data-action'); $.post( "/x/productaddreview/vote", {ident:ident, decision:decision}) .done(function(response) { var data = JSON.parse(response); $(parent).find('.review-count-up').text(data.up); $(parent).find('.review-count-down').text(data.down); }); }); var assignToSipController = new bdSipAssignModal({ assign: function(ident){ console.log(ident); $('#globalmodal').hide(); }, cancelled: function(){ $('#globalmodal').hide(); } }); $('.btn-action-sip').on('click', function(e){ e.preventDefault(); bdwidget('modalassigntosip', {}).done(function(html){ $('#globalmodal').html(html); assignToSipController.attach($('#globalmodal')); $('#globalmodal').show(); }); }); $('.btn-action-invent').on('click', function(e){ e.preventDefault(); }); }); var cart_updateTotals = function(){ var gTotal = $('.pro-check-out .price'); var items = $('.pro-cart-item-wrap .pro-cart-item'); var total = 0; for(var i = 0; i != items.length; i++){ var item = items[i]; var price = $($(item).find('.pro-cart-block-tot-price')[0]).text(); price = price.substring(1); price = +(price); total += price; } gTotal.text('$' + total.toFixed(2)); if(total == 0){ window.location.href='/'; } } $(window).on("load", function() { //=================Scrollbar function ================ if ($('.ai-list').length) { $(".ai-list").mCustomScrollbar(); } if ($('.nav-scroll').length) { $(".nav-scroll").mCustomScrollbar(); } }); //DD terms toggle function toggleDivs(src, selectedDivID, divsName) { var divList = document.getElementsByName(divsName); var styleName; var lastDiv; var oldClass = src.className; var selected = false; for(i=0; i