(function ($) { "use strict"; /*---------------------------- jQuery MeanMenu ------------------------------ */ jQuery('nav#dropdown').meanmenu(); /*---------------------------- wow js active ------------------------------ */ new WOW().init(); /*---------------------------- product-slider ------------------------------ */ $('.product-slider').slick({ speed: 300, slidesToShow: 4, slidesToScroll: 1, prevArrow: '', nextArrow: '', responsive: [ { breakpoint: 1200, settings: { slidesToShow: 3, } }, { breakpoint: 992, settings: { slidesToShow: 2, } }, { breakpoint: 768, settings: { slidesToShow: 1, } }, ] }); /*---------------------------- discount-product-slider ------------------------------ */ $('.discount-product-slider').slick({ autoplay: false, arrows: false, dots: true, speed: 500, slidesToShow: 1, slidesToScroll: 1, responsive: [ { breakpoint: 1169, settings: { slidesToShow: 1, } }, { breakpoint: 969, settings: { slidesToShow: 1, } }, { breakpoint: 767, settings: { slidesToShow: 1, } }, ] }); /*---------------------------- brand-slider ------------------------------ */ $('.brand-slider').slick({ autoplay: false, arrows: false, dots: false, speed: 300, slidesToShow: 4, slidesToScroll: 1, responsive: [ { breakpoint: 1169, settings: { slidesToShow: 4, } }, { breakpoint: 969, settings: { slidesToShow: 3, } }, { breakpoint: 767, settings: { slidesToShow: 2, } }, { breakpoint: 480, settings: { slidesToShow: 1, } }, ] }); /*---------------------------- single-pro-slider ------------------------------ */ $('.slider-for').slick({ slidesToShow: 1, slidesToScroll: 1, arrows: false, fade: true, asNavFor: '.slider-nav' }); $('.slider-nav').slick({ slidesToShow: 4, slidesToScroll: 1, asNavFor: '.slider-for', dots: false, arrows: true, centerMode: false, responsive: [ { breakpoint: 480, settings: { slidesToShow: 2, } }, ], focusOnSelect: true, prevArrow: '
Days
%-HHour
%MMin
')); }); }); /*--------------------- treeview --------------------- */ $("#cat-treeview ul").treeview({ animated: "normal", persist: "location", collapsed: true, unique: true, }); /*---------------------------- price-slider active ------------------------------ */ $("#slider-range").slider({ range: true, min: 50, max: 2000, values: [0, 999], slide: function (event, ui) { $("#amount").val("$" + ui.values[0] + " - $" + ui.values[1]); } }); $("#amount").val("$" + $("#slider-range").slider("values", 0) + " - $" + $("#slider-range").slider("values", 1)); /*---------------------------- Cart Plus Minus Button ------------------------------ */ $(".cart-plus-minus").prepend(' '); $(".cart-plus-minus").append(' '); $(".qtybutton").on("click", function () { var $button = $(this); var oldValue = $button.parent().find("input").val(); if ($button.text() == "+") { var newVal = parseFloat(oldValue) + 1; } else { // Don't allow decrementing below zero if (oldValue > 1) { var newVal = parseFloat(oldValue) - 1; } else { newVal = 1; } } $button.parent().find("input").val(newVal); }); /*------------------------- accordion toggle function --------------------------*/ $('.payment-accordion').find('.payment-accordion-toggle').on('click', function () { //Expand or collapse this panel $(this).next().slideToggle(500); //Hide the other panels $(".payment-content").not($(this).next()).slideUp(500); }); /* ------------------------------------------------------- accordion active class for style ----------------------------------------------------------*/ $('.payment-accordion-toggle').on('click', function (event) { $(this).siblings('.active').removeClass('active'); $(this).addClass('active'); event.preventDefault(); }); /*-------------------------- scrollUp ---------------------------- */ $.scrollUp({ scrollText: '', easingType: 'linear', scrollSpeed: 900, animation: 'fade' }); /*-------------------------- shop page manu dropdown ---------------------------- */ $('.dropdown .option-btn').on('click', function () { if ($(this).siblings('.dropdown-menu').hasClass('active')) { $(this).siblings('.dropdown-menu').removeClass('active').slideUp(); $(this).removeClass('active'); } else { $('.dropdown .dropdown-menu').removeClass('active').slideUp(); $('.dropdown .option-btn').removeClass('active'); $(this).addClass('active'); $(this).siblings('.dropdown-menu').addClass('active').slideDown(); } }); /*-------------------------------- Ajax Contact Form -------------------------------- */ $(function () { // Get the form. var form = $('#contact-form'); // Get the messages div. var formMessages = $('.form-message'); // Set up an event listener for the contact form. $(form).submit(function (e) { // Stop the browser from submitting the form. e.preventDefault(); // Serialize the form data. var formData = $(form).serialize(); // Submit the form using AJAX. $.ajax({ type: 'POST', url: $(form).attr('action'), data: formData, }) .done(function (response) { // Make sure that the formMessages div has the 'success' class. $(formMessages).removeClass('error'); $(formMessages).addClass('success'); // Set the message text. $(formMessages).text(response); // Clear the form. $('#contact-form input,#contact-form textarea').val(''); }) .fail(function (data) { // Make sure that the formMessages div has the 'error' class. $(formMessages).removeClass('success'); $(formMessages).addClass('error'); // Set the message text. if (data.responseText !== '') { $(formMessages).text(data.responseText); } else { $(formMessages).text( 'Oops! An error occured and your message could not be sent.' ); } }); }); }); })(jQuery);