function wpsg_switchProductview(index, page, order, mode) { var atts = jQuery.parseJSON(jQuery('#wpsg_productview_' + index + ' input[name="wpsg_atts"]').val()); atts.page = page; atts.order = order; atts.mode = mode; if (jQuery('#wpsg_mod_productview_filter').length > 0) { atts.filter = jQuery('#wpsg_mod_productview_filter input').serialize(); } jQuery('#wpsg_productview_' + index).append('
'); jQuery.ajax( { 'url': wpsg_ajax.ajaxurl, 'data': { 'wpsg_mod': 'wpsg_mod_productview', 'wpsg_action': 'refresh', 'wpsg_atts': atts }, 'success': function(data) { jQuery('#wpsg_productview_' + index).replaceWith(data); wpsg_correctProductview(index); } } ); return false; } function wpsg_correctProductview(index) { var max_height = 0; jQuery('#wpsg_productview_' + index + ' .wpsg_mod_productview_name').each(function() { if (jQuery(this).outerHeight() > max_height) max_height = jQuery(this).outerHeight(); } ).outerHeight(max_height); var max_height = 0; jQuery('#wpsg_productview_' + index + ' .wpsg_mod_productview_description').each(function() { if (jQuery(this).outerHeight() > max_height) max_height = jQuery(this).outerHeight(); } ).outerHeight(max_height); } jQuery(document).ready(function() { var filter_min = parseFloat(jQuery('#wpsg_mod_productview_filter_price_info input[name="price_min"]').val()); var filter_max = parseFloat(jQuery('#wpsg_mod_productview_filter_price_info input[name="price_max"]').val()); jQuery("#wpsg_mod_productview_filter_price-range").slider( { range: true, min: filter_min, max: filter_max, values: [filter_min, filter_max], slide: function(event, ui) { jQuery('#wpsg_mod_productview_filter_price_info input[name="price_min"]').val(ui.values[0]); jQuery('#wpsg_mod_productview_filter_price_info input[name="price_max"]').val(ui.values[1]); jQuery('#wpsg_mod_productview_filter_price_info .min').html(wpsg_numberformat(ui.values[0], 2)); jQuery('#wpsg_mod_productview_filter_price_info .max').html(wpsg_numberformat(ui.values[1], 2)); }, stop: function(event, ui) { wpsg_switchProductview(1, 1); } } ); jQuery('.wpsg_productview').each(function() { var x = jQuery(this).attr("id").substr(17); wpsg_correctProductview(x); } ); } );