I am working on making a slider that has different prices using jQuery and a little rangeslider.js. I made everything work, but the second two numbers only change when I move the slider, not when I check the checkbox. I am trying to make the numbers change right when I click the checkbox.
$(document).on('input change', '#range-slider', '#voiceover', function() { //Listen to slider changes (input changes)
var v=$(this).val();
var voiceOption = $('#voiceover');//Create a Variable (v), and store the value of the input change (Ex. Image 2 [imageURL])
console.log(v);
$('#sliderStatus').html(videoDuration[v]);
$('#sliderPrice').html('<span>$'+videoSubtotal[v]+'.00</span>');
var totalPrice = parseInt(voiceoverSubtotal[v])+parseInt(videoSubtotal[v]);
if(voiceOption.is(":checked")){
$('#voiceoverspan').html('<span>$'+voiceoverSubtotal[v]+'.00</span>');
$('#totalspan').html('<span>$'+totalPrice+'.00</span>');
}
else{
$('#voiceoverspan').html('<span>$0.00</span>');
$('#totalspan').html('<span>$'+videoSubtotal[v]+'.00</span>');
}
/*if(voiceOption.is(":checked") ){
$('#totalspan').html('<span>$'+totalPrice+'.00</span>');
}
else{
$('#totalspan').html('<span>$'+videoSubtotal[v]+'.00</span>');
}*/
});
Thank you so much my codepen is here: http://ift.tt/2fiRLxc
Aucun commentaire:
Enregistrer un commentaire