$(document).ready(function() { $.getJSON('/action_meter/6808.json' + '?time=' + parseInt((new Date)/1000), function(data) { $('[id=action_meter_6808]').html( '
' + '
目標' + data.goal + '人
' + '
0
' + '
' ); var goal = data.goal ? data.goal : 1; if (data.actual > goal) { goal = data.actual; } var width = data.actual / goal * 100; if (width >= 100) { width = 105; } $('[id=action_meter_bar_6808]').animate({ width: width + "%" }, { duration: 3000, step: function(now, fx) { var actual = Math.min(data.actual, Math.ceil(goal * now / 100)); $('[id=action_meter_actual_6808]').html(actual); } }); }); });