2021-12-20 13:41:59 +00:00
|
|
|
jQuery(function(m){function t(t,a){var e;return function(){clearTimeout(e),e=setTimeout(function(){e=void 0,t.call()},a)}}var u,f;function a(){try{return generateWooCommerce.hooks.generateQuantityButtons()}catch(t){}var a,e;if(m(".woocommerce div.product form.cart").first().closest(".elementor-add-to-cart").length)m(".elementor.product").removeClass("do-quantity-buttons");else{try{a=generateWooCommerce.selectors.generateQuantityButtons.quantityBoxes}catch(t){a=m(".cart div.quantity:not(.buttons-added), .cart td.quantity:not(.buttons-added)").find(".qty")}try{if(0===a.length)return}catch(t){return}try{e=generateWooCommerce.callbacks.generateQuantityButtons.quantityBoxes}catch(t){e=function(t,a){var e,s=m(a);-1===["date","hidden"].indexOf(s.prop("type"))&&(s.parent().addClass("buttons-added").prepend('<a href="javascript:void(0)" class="minus">-</a>'),s.after('<a href="javascript:void(0)" class="plus">+</a>'),(e=parseFloat(m(this).attr("min")))&&0<e&&parseFloat(m(this).val())<e&&m(this).val(e),s.parent().find(".plus, .minus").on("click",function(){var t=parseFloat(s.val()),a=parseFloat(s.attr("max")),e=parseFloat(s.attr("min")),o=s.attr("step");t&&""!==t&&"NaN"!==t||(t=0),""!==a&&"NaN"!==a||(a=""),""!==e&&"NaN"!==e||(e=0),"any"!==o&&""!==o&&void 0!==o&&"NaN"!==parseFloat(o)||(o=1),m(this).is(".plus")?a&&(a===t||a<t)?s.val(a):s.val(t+parseFloat(o)):e&&(e===t||t<e)?s.val(e):0<t&&s.val(t-parseFloat(o)),s.trigger("change")}))}}m.each(a,e)}}m("body").on("added_to_cart",function(){m(".wc-menu-item").hasClass("has-items")||m(".wc-menu-item").addClass("has-items"),m(".wc-mobile-cart-items").hasClass("has-items")||m(".wc-mobile-cart-items").addClass("has-items")}),m("body").on("removed_from_cart",function(){var t=m(".number-of-items");t.length&&t.hasClass("no-items")&&(m(".wc-menu-item").removeClass("has-items"),m(".wc-mobile-cart-items").removeClass("has-items"))}),generateWooCommerce.addToCartPanel&&(m(document.body).on("added_to_cart",function(){var t=m("#wpadminbar"),a=m(".navigation-stick"),e=0;t.length&&(e=t.outerHeight()),a.length&&"0px"===a.css("top")&&(e+=a.outerHeight()),m(".add-to-cart-panel").addClass("item-added").css({"-webkit-transform":"translateY("+e+"px)","-ms-transform":"translateY("+e+"px)",transform:"translateY("+e+"px)"})}),m(".add-to-cart-panel .continue-shopping").on("click",function(t){t.preventDefault(),m(".add-to-cart-panel").removeClass("item-added").css({"-webkit-transform":"translateY(-100%)","-ms-transform":"translateY(-100%)",transform:"translateY(-100%)"})}),m(window).on("scroll",t(function(){var t=m(".add-to-cart-panel");t.hasClass("item-added")&&t.removeClass("item-added").css({"-webkit-transform":"translateY(-100%)","-ms-transform":"translateY(-100%)",transform:"translateY(-100%)"})},250))),generateWooCommerce.stickyAddToCart&&(u=0,f=300,m(window).on("scroll",t(function(){var t=m("#wpadminbar"),a=m(".navigation-stick"),e=m(".stuckElement"),o=0,s=m(window).scrollTop(),r=m(".add-to-cart-panel"),n=r.offset().top+r.outerHeight(),i=m(".single_add_to_cart_button"),c=i.offset().top,l=i.outerHeight(),d=m(".site-footer").offset().top;0===e.length&&(f=0),c+l<s&&n<d?setTimeout(function(){t.length&&(o=t.outerHeight()),a.length&&(a.hasClass("auto-hide-sticky")?(s<u&&"0px"===a.css("top")&&(o+=a.outerHeight()),u=s):o+=a.outerHeight()),r.addClass("show-sticky-add-to-cart").css({"-webkit-transform":"translateY("+o+"px)","-ms-transform":"translateY("+o+"px)",transform:"translateY("+o+"px)"})},f):r.removeClass("show-sticky-add-to-cart").css({"-webkit-transform":"","-ms-transform":"",transform:""})},50)),m(".go-to-variables").on("click",function(t){t.preventDefault();var a=0,e=m(".navigation-stick"),o=m("#wpadminbar");e.length&&(a=e.outerHeight()),o.length&&(a+=o.outerHeight()),m("html, body").animate({scrollTop:m(".variations").offset().top-a},250)})),m(function(){"use strict";generateWooCommerce.quantityButtons&&a()}),m(document).ajaxComplete(function(){"use strict";generateWooCommerce.quantityButtons&&a()})});
|