// // Hide Header on on scroll down // var didScroll; // var lastScrollTop = 0; // var delta = 5; // var navbarHeight = $(".nav").outerHeight(); // $(window).scroll(function (event) { // didScroll = true; // }); // setInterval(function () { // if (didScroll) { // hasScrolled(); // didScroll = false; // } // }, 250); // $(".singleSelect").select2({ // allowClear: true, // }); // $(document).on("click", ".mobileFilterBtn", function () { // $(".filterItem").toggle("slow"); // $(this).toggleClass("rotate"); // }); // $(document).ready(function () { // $(".form_date").datepicker({ // format: "M dd yyyy", // orientation: "bottom", // }); // }); // function hasScrolled() { // var st = $(this).scrollTop(); // // Make sure they scroll more than delta // if (Math.abs(lastScrollTop - st) <= delta) return; // // If they scrolled down and are past the navbar, add class .nav-up. // // This is necessary so you never see what is "behind" the navbar. // if (st > lastScrollTop && st > navbarHeight) { // // Scroll Down // $(".nav").addClass("nav-up"); // } else { // // Scroll Up // if (st + $(window).height() < $(document).height()) { // $(".nav").removeClass("nav-up"); // } // } // lastScrollTop = st; // } $(window).scroll(function () { if ($(window).scrollTop() > 100) { alert("hi"); $(".mainMenuWrap").addClass("fixedSubMenu"); $(".mainMenuWrap").removeClass("nonfixedSubMenu"); $(".scrollTop").fadeIn(); $(".sticky").addClass("paddingTop100"); } else { $(".mainMenuWrap").removeClass("fixedSubMenu"); $(".mainMenuWrap").addClass("nonfixedSubMenu"); $(".scrollTop").fadeOut(); $(".sticky").removeClass("paddingTop100"); } }); $(document).on("click", ".mobileFilterBtn", function () { $(".filterItem").toggle("slow"); $(this).toggleClass("rotate"); }); $(document).on("click", ".shippingTypeBtn", function () { $(".shippingTypeBtn").removeClass("active"); $(this).addClass("active"); }); $(document).on("click", ".loveBtn", function () { $(this).toggleClass("active"); }); $(".sortingWrap a").click(function () { $(".sortingWrap a").removeClass("active"); $(this).addClass("active"); }); $(".comePack a").click(function () { $(".comePack a").removeClass("active"); $(this).addClass("active"); $(".comePackAddress").fadeIn(); $(".paymentWay").fadeIn(); }); $("#tabs-nav li").click(function () { $("#tabs-nav li").removeClass("active"); $(this).addClass("active"); $(".tab-content").hide(); var activeTab = $(this).find("a").attr("href"); $(activeTab).fadeIn(); return false; }); $("input[type=radio][name=addressName]").change(function () { if ($(this).is(":checked")) { $(".addressShippng").fadeIn(); $(".paymentWay").fadeIn(); } else { $(".addressShippng").hide(); $(".paymentWay").hide(); } }); $("input[type=radio][name=payment]").change(function () { var value = $(this).val(); if (value == "atm") { $(".atmDes").fadeIn(); } else { $(".atmDes").hide(); } }); $("input[type=radio][name=shippingType]").change(function () { var type = $(this).val(); console.log(type); switch (type) { case "shippingHome": $("input[type=radio][name=addressName]").prop("checked", false); $(".addressWrap").fadeIn(); $(".comePack").hide(); $(".comePackAddress").hide(); $(".packShop").hide(); $(".paymentWay").hide(); $(".addressShippng").hide(); // code block break; case "shippingPoint": $(".comePack").fadeIn(); $(".addressWrap").hide(); $(".packShop").hide(); $(".addressWrap").hide(); $(".paymentWay").hide(); $(".addressShippng").hide(); $(".comePackBtn").removeClass("active"); // code block break; case "shippingShop": $(".packShop").fadeIn(); $(".comePack").hide(); $(".comePackAddress").hide(); $(".addressWrap").hide(); $(".paymentWay").fadeIn(); $(".addressShippng").hide(); // code block break; // code block } }); // var countries = new Bloodhound({ // datumTokenizer: Bloodhound.tokenizers.whitespace, // queryTokenizer: Bloodhound.tokenizers.whitespace, // // url points to a json file that contains an array of country names, see // // https://github.com/twitter/typeahead.js/blob/gh-pages/data/countries.json // prefetch: "../assets/json/country.json", // }); // var carrier = new Bloodhound({ // datumTokenizer: Bloodhound.tokenizers.whitespace, // queryTokenizer: Bloodhound.tokenizers.whitespace, // // url points to a json file that contains an array of country names, see // // https://github.com/twitter/typeahead.js/blob/gh-pages/data/countries.json // prefetch: "../assets/json/carrier.json", // }); // $(".formAutoComplete").typeahead(null, { // name: "countries", // source: countries, // }); // $(".toAutoComplete").typeahead(null, { // name: "countries", // source: countries, // }); // $(".carrierAutoComplete").typeahead(null, { // name: "carrier", // source: carrier, // }); $(".scrollTop").click(function () { // When arrow is clicked $("html").animate( { scrollTop: 0, // Scroll to top of body }, 500 ); });