1// Start Wrapper 2jQuery(document).ready( function($) { 3 'use strict'; 4 5 // Mobile Nav Toggle 6 $('#at-navtoggle').on( 'click', function(e) { 7 $('#at-navtoggle').toggleClass("active"); 8 e.preventDefault(); 9 } ); 10 11// End Wrapper 12} ); 13 14 15 16/* 17WooCommerce QTY Buttons */ 18(function($) { 19 function createQTYButtons(target) { 20 // Quantity buttons 21 $(target).find('div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)').addClass('buttons_added').append('<input type="button" value="+" class="plus" />').prepend('<input type="button" value="-" class="minus" />'); 22 // Target quantity inputs on product pages 23 $(target).find('input.qty:not(.product-quantity input.qty)').each(function() { 24 var min = parseFloat($(this).attr('min')); 25 if (min && min > 0 && parseFloat($(this).val()) < min) { 26 $(this).val(min); 27 } 28 }); 29 $(target).on('click', '.plus, .minus', function() { 30 // Get values 31 var $qty = $(this).closest('.quantity').find('.qty'), 32 currentVal = parseFloat($qty.val()), 33 max = parseFloat($qty.attr('max')), 34 min = parseFloat($qty.attr('min')), 35 step = $qty.attr('step'); 36 // Format values 37 if (!currentVal || currentVal === '' || currentVal === 'NaN') currentVal = 0; 38 if (max === '' || max === 'NaN') max = ''; 39 if (min === '' || min === 'NaN') min = 1; 40 if (step === 'any' || step === '' || step === undefined || parseFloat(step) === 'NaN') step = 1; 41 // Change the value 42 if ($(this).is('.plus')) { 43 if (max && (max == currentVal || currentVal > max)) { 44 $qty.val(max); 45 } else { 46 $qty.val(currentVal + parseFloat(step)); 47 } 48 } else { 49 if (min && (min == currentVal || currentVal < min)) { 50 $qty.val(min); 51 } else if (currentVal > 0) { 52 $qty.val(currentVal - parseFloat(step)); 53 } 54 } 55 // Trigger change event 56 $qty.trigger('change'); 57 }); 58 } 59 // jQuery plugin. 60 $.fn.addQty = function() { 61 return this.each(function(i, el) { 62 createQTYButtons(el); 63 }); 64 } 65})(jQuery); 66 67;(function ($) { 68"use strict"; 69 70// Create QTY Buttons to product pages 71$('.at-woo_prod-style2').addQty(); 72})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.