Created
October 17, 2012 22:31
-
-
Save SpencerCooley/3908756 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.each(month, function(index, value){ | |
$( "#"+ value +"_"+type ).slider({ | |
orientation: "horizontal", | |
range: "min", | |
min: 0, | |
max: 100, | |
value: 8.33, | |
slide: function( event, ui ) { | |
var total = parseInt($('.'+type+'_jan_slider_position').html()) + parseInt($('.'+type+'_feb_slider_position').html()) + parseInt($('.'+type+'_mar_slider_position').html()) + parseInt($('.'+type+'_apr_slider_position').html()) + parseInt($('.'+type+'_may_slider_position').html()) + parseInt($('.'+type+'_jun_slider_position').html()) + parseInt($('.'+type+'_jul_slider_position').html()) + parseInt($('.'+type+'_aug_slider_position').html()) + parseInt($('.'+type+'_sep_slider_position').html()) + parseInt($('.'+type+'_oct_slider_position').html()) + parseInt($('.'+type+'_nov_slider_position').html()) + parseInt($('.'+type+'_dec_slider_position').html()) | |
console.log(total) | |
var stopper = total-ui.value; | |
var marker = ui.value | |
if( marker > total){ | |
marker = stopper; | |
return false; | |
} | |
else{ | |
var goalinit = datainitRevised[type].goal; | |
var count = (ui.value/100)*goalinit; | |
var premium = datainitRevised[type].premium*count; | |
$('.'+type+'_'+value+'_slider_position').html(ui.value); | |
$('.'+type+'_'+value+'_count').html(count); | |
$('.'+type+'_'+value+'_premium').html(premium); | |
} | |
} | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment