Increase donation count by 1% each time.

Increasing by one makes it last too long.  Doing 1% will make it go just
as fast as the fundraiser.
This commit is contained in:
Bradley M. Kuhn 2015-03-11 18:38:38 -07:00
parent a7a15cec8b
commit 76f5e1b7ea

View file

@ -14,7 +14,8 @@ $(document).ready(function() {
var percentage = (parseFloat(noCommaSoFar) / parseFloat(noCommaGoal)) * 100;
var curValue = 0.00;
var incrementSoFar = 0.00;
var incrementDonationCount = 0;
var curDonationCount = 0;
var incrementDonationCount = Math.round( 0.01 * donationCount );
$('span#fundraiser-percentage').css({ 'color' : 'green',
'font-weight' : 'bold',
@ -36,11 +37,11 @@ $(document).ready(function() {
}
}
function riseDonationCount() {
if (incrementDonationCount >= noCommaDonationCount) {
if (curDonationCount >= noCommaDonationCount) {
$('span#fundraiser-donation-count').text(donationCount);
} else {
$('span#fundraiser-donation-count').text(incrementDonationCount.toLocaleString());
incrementDonationCount++;
$('span#fundraiser-donation-count').text(curDonationCount.toLocaleString());
incrementDonationCount += incrementDonationCount;
setTimeout(riseDonationCount, 50);
}
}