Mathematical equations with jQuery UI Slider -
i have multiple sliders , updates total slider accordingly per each slider. when go slide slider subtracts again original total value , not updated value subtracting previous slider amount.
// photographer slider $('#tablephotographer').toggle(this.checked); $(function() { $( "#photo-range-min" ).slider({ range: "min", value: photo, min: 1, max: photo, slide: function( event, ui ) { $( "#photo_amount" ).val( "$" + ui.value ); $( "#total_amount").val("$" + (number(ui.value) + number(cityvalue - photo))); } }); $( "#photo_amount" ).val( "$" + $( "#photo-range-min" ).slider( "value" ).tofixed(2) ); }); // ceremony slider $('#tableceremony').toggle(this.checked); $(function() { $( "#ceremony-range-min" ).slider({ range: "min", value: ceremony, min: 1, max: ceremony, slide: function( event, ui ) { $( "#ceremony_amount" ).val( "$" + ui.value ); $( "#total_amount").val("$" + (number(ui.value) + number(cityvalue - ceremony))); } }); //total slider $('.budgettable').fadein(500); $( "#total-range-min" ).slider({ range: "min", value: cityvalue, min: 1, max: cityvalue, slide: function( event, ui ) { $( "#total_amount" ).val( "$" + ui.value); } }); $('#state_cost').text("based on selecttion, average wedding cost in state $" + cityvalue); $( "#total_amount" ).val( "$" + $( "#total-range-min" ).slider( "value" ) );
as can see, 2 sliders subtract same value, need store changed value per slider , show them in total slider. want able able update value according each slider.
Comments
Post a Comment