slider triggers

This commit is contained in:
Mike Jolley 2012-02-16 18:12:14 +00:00
parent 2ca3e7f5cc
commit 1697bcd66c
2 changed files with 11 additions and 12 deletions

View File

@ -14,8 +14,7 @@ jQuery(document).ready(function($) {
if (woocommerce_price_slider_params.min_price) current_min_price = parseInt(woocommerce_price_slider_params.min_price);
if (woocommerce_price_slider_params.max_price) current_max_price = parseInt(woocommerce_price_slider_params.max_price);
function update_price_span( min, max ) {
$('body').bind('price_slider_create price_slider_slide', function( event, min, max ) {
if (woocommerce_price_slider_params.currency_pos == "left") {
$( ".price_slider_amount span.from" ).html( woocommerce_price_slider_params.currency_symbol + min );
@ -37,8 +36,7 @@ jQuery(document).ready(function($) {
$( ".price_slider_amount span.to" ).html( max + " " + woocommerce_price_slider_params.currency_symbol );
}
}
});
$('.price_slider').slider({
range: true,
@ -48,22 +46,23 @@ jQuery(document).ready(function($) {
values: [current_min_price,current_max_price],
create : function( event, ui ) {
update_price_span(current_min_price, current_max_price);
$( ".price_slider_amount #min_price" ).val(current_min_price);
$( ".price_slider_amount #max_price" ).val(current_max_price);
$('body').trigger('price_slider_create');
$('body').trigger('price_slider_create', [current_min_price, current_max_price]);
},
slide: function( event, ui ) {
update_price_span(ui.values[ 0 ], ui.values[ 1 ]);
$( "input#min_price" ).val(ui.values[ 0 ]);
$( "input#max_price" ).val(ui.values[ 1 ]);
$('body').trigger('price_slider_slide');
}
$('body').trigger('price_slider_slide', [ui.values[ 0 ], ui.values[ 1 ]] );
},
change: function( event, ui ) {
$('body').trigger('price_slider_change', [ui.values[ 0 ], ui.values[ 1 ]] );
},
});
});

View File

@ -1 +1 @@
jQuery(document).ready(function(a){function d(b,c){if(woocommerce_price_slider_params.currency_pos=="left"){a(".price_slider_amount span.from").html(woocommerce_price_slider_params.currency_symbol+b);a(".price_slider_amount span.to").html(woocommerce_price_slider_params.currency_symbol+c)}else if(woocommerce_price_slider_params.currency_pos=="left_space"){a(".price_slider_amount span.from").html(woocommerce_price_slider_params.currency_symbol+" "+b);a(".price_slider_amount span.to").html(woocommerce_price_slider_params.currency_symbol+" "+c)}else if(woocommerce_price_slider_params.currency_pos=="right"){a(".price_slider_amount span.from").html(b+woocommerce_price_slider_params.currency_symbol);a(".price_slider_amount span.to").html(c+woocommerce_price_slider_params.currency_symbol)}else if(woocommerce_price_slider_params.currency_pos=="right_space"){a(".price_slider_amount span.from").html(b+" "+woocommerce_price_slider_params.currency_symbol);a(".price_slider_amount span.to").html(c+" "+woocommerce_price_slider_params.currency_symbol)}}a("input#min_price, input#max_price").hide();a(".price_slider, .price_label").show();var b=a(".price_slider_amount #min_price").attr("data-min"),c=a(".price_slider_amount #max_price").attr("data-max");current_min_price=parseInt(b);current_max_price=parseInt(c);woocommerce_price_slider_params.min_price&&(current_min_price=parseInt(woocommerce_price_slider_params.min_price));woocommerce_price_slider_params.max_price&&(current_max_price=parseInt(woocommerce_price_slider_params.max_price));a(".price_slider").slider({range:!0,animate:!0,min:b,max:c,values:[current_min_price,current_max_price],create:function(b,c){d(current_min_price,current_max_price);a(".price_slider_amount #min_price").val(current_min_price);a(".price_slider_amount #max_price").val(current_max_price);a("body").trigger("price_slider_create")},slide:function(b,c){d(c.values[0],c.values[1]);a("input#min_price").val(c.values[0]);a("input#max_price").val(c.values[1]);a("body").trigger("price_slider_slide")}})});
jQuery(document).ready(function(a){a("input#min_price, input#max_price").hide();a(".price_slider, .price_label").show();var b=a(".price_slider_amount #min_price").attr("data-min"),c=a(".price_slider_amount #max_price").attr("data-max");current_min_price=parseInt(b);current_max_price=parseInt(c);woocommerce_price_slider_params.min_price&&(current_min_price=parseInt(woocommerce_price_slider_params.min_price));woocommerce_price_slider_params.max_price&&(current_max_price=parseInt(woocommerce_price_slider_params.max_price));a("body").bind("price_slider_create price_slider_slide",function(b,c,d){if(woocommerce_price_slider_params.currency_pos=="left"){a(".price_slider_amount span.from").html(woocommerce_price_slider_params.currency_symbol+c);a(".price_slider_amount span.to").html(woocommerce_price_slider_params.currency_symbol+d)}else if(woocommerce_price_slider_params.currency_pos=="left_space"){a(".price_slider_amount span.from").html(woocommerce_price_slider_params.currency_symbol+" "+c);a(".price_slider_amount span.to").html(woocommerce_price_slider_params.currency_symbol+" "+d)}else if(woocommerce_price_slider_params.currency_pos=="right"){a(".price_slider_amount span.from").html(c+woocommerce_price_slider_params.currency_symbol);a(".price_slider_amount span.to").html(d+woocommerce_price_slider_params.currency_symbol)}else if(woocommerce_price_slider_params.currency_pos=="right_space"){a(".price_slider_amount span.from").html(c+" "+woocommerce_price_slider_params.currency_symbol);a(".price_slider_amount span.to").html(d+" "+woocommerce_price_slider_params.currency_symbol)}});a(".price_slider").slider({range:!0,animate:!0,min:b,max:c,values:[current_min_price,current_max_price],create:function(b,c){a(".price_slider_amount #min_price").val(current_min_price);a(".price_slider_amount #max_price").val(current_max_price);a("body").trigger("price_slider_create",[current_min_price,current_max_price])},slide:function(b,c){a("input#min_price").val(c.values[0]);a("input#max_price").val(c.values[1]);a("body").trigger("price_slider_slide",[c.values[0],c.values[1]])},change:function(b,c){a("body").trigger("price_slider_change",[c.values[0],c.values[1]])}})});