jQuery(document).ready(function () { //products tab section jQuery('.acommerce-products-tab').on('click', 'li.tabs-title a', function (e) { //add the active class jQuery(this).parent().parent().find('li').removeClass('is-active'); jQuery(this).parent().addClass('is-active'); e.preventDefault(); var select_category_id = jQuery(this).attr('id'); var acommerce_tab_product_count = jQuery(this).attr('product_count'); var widget = jQuery(this).closest(".news_class"); var id = jQuery(widget).attr('id'); var storage_id = id + "-" + select_category_id; var data = localStorage.getItem(storage_id); var that = jQuery(this); var acommerce_tab_content = that.closest(".widget_acommerce_products_tabs_widget").find("#acommerce-products-tab-block"); jQuery.ajax({ url: aCommerce_Ajax.ajaxurl, type: 'post', async: false, data: { action: 'acommerce_tabs_section', post_id: select_category_id, prduct_count: acommerce_tab_product_count, }, success: function (response) { setTimeout(function () { localStorage.setItem(storage_id, data); jQuery(acommerce_tab_content).html(response); //flex slider 5 jQuery('.flexslider5').flexslider({ animation: "slide", animationLoop: true, itemWidth: 260, itemMargin: 20, minItems: 2, maxItems: 4 }); }, 1000); }, beforeSend: function () { jQuery(acommerce_tab_content).html('

'); }, }); }); });