jQuery(document).ready(function ($) { // Prevent Disable Functions $('.disabled').click(function(e){ e.preventDefault(); }); $('.variations_form .variations ul.variable-items-wrapper').each(function (i, el) { var select = $(this).prev('select'); var li = $(this).find('li'); $(this).on('click', 'li:not(.selected)', function () { var value = $(this).data('value'); li.removeClass('selected'); select.val(value).trigger('change'); $(this).addClass('selected'); }); $(this).on('click', 'li.selected', function () { li.removeClass('selected'); select.val('').trigger('change'); select.trigger('click'); select.trigger('focusin'); select.trigger('touchstart'); }); }); }); (function ($) { $(function () { $('.roxtheme-countdown').each(function () { var $countdown = $(this); $countdown.countdown($countdown.data('date'), function(event) { $(this).html(event.strftime('
%D
'+ 'Days' +'
%H
'+ 'Hrs' +'
%M
'+ 'Mins' +'
%S
'+ 'Secs' +'
')); }); }); }); $('.disabled').click(function(e){ e.preventDefault(); }); $('.quantity input.qty').after('+-'); $(document).on('click', 'span.qty-btn', function ( event ) { var $target = $(event.target), $input = $target.parents('.quantity').find('input[type="number"]'), max = Number( $input.attr('max') ), min = Number( $input.attr('min') ), step = Number( $input.attr('step') ), value = Number( $input.val() ); if( $target.hasClass('inc') ) { value = value+step; if( max != 0 && value > max ) return; $input.val( value ); $input.trigger('change'); } if( $target.hasClass('dec') ) { value = value - step; if( value < min ) return; $input.val( value ); $input.trigger('change'); } }); $(document).on('click', '.mini_cart_item a.remove', function (e) { e.preventDefault(); var product_id = $(this).attr("data-product_id"), cart_item_key = $(this).attr("data-cart_item_key"), product_container = $(this).parents('.mini_cart_item'); // Add loader product_container.block({ message: null, overlayCSS: { cursor: 'none' } }); $.ajax({ type: 'POST', dataType: 'json', url: wc_add_to_cart_params.ajax_url, data: { action: "product_remove", product_id: product_id, cart_item_key: cart_item_key }, success: function(response) { if ( ! response || response.error ) return; var fragments = response.fragments; // Replace fragments if ( fragments ) { $.each( fragments, function( key, value ) { $( key ).replaceWith( value ); }); } } }); }); })(jQuery); jQuery( document ).ready(function( $ ) { $("#preloader").hide(); });