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:
parent
a7a15cec8b
commit
76f5e1b7ea
1 changed files with 5 additions and 4 deletions
|
@ -14,7 +14,8 @@ $(document).ready(function() {
|
||||||
var percentage = (parseFloat(noCommaSoFar) / parseFloat(noCommaGoal)) * 100;
|
var percentage = (parseFloat(noCommaSoFar) / parseFloat(noCommaGoal)) * 100;
|
||||||
var curValue = 0.00;
|
var curValue = 0.00;
|
||||||
var incrementSoFar = 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',
|
$('span#fundraiser-percentage').css({ 'color' : 'green',
|
||||||
'font-weight' : 'bold',
|
'font-weight' : 'bold',
|
||||||
|
@ -36,11 +37,11 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function riseDonationCount() {
|
function riseDonationCount() {
|
||||||
if (incrementDonationCount >= noCommaDonationCount) {
|
if (curDonationCount >= noCommaDonationCount) {
|
||||||
$('span#fundraiser-donation-count').text(donationCount);
|
$('span#fundraiser-donation-count').text(donationCount);
|
||||||
} else {
|
} else {
|
||||||
$('span#fundraiser-donation-count').text(incrementDonationCount.toLocaleString());
|
$('span#fundraiser-donation-count').text(curDonationCount.toLocaleString());
|
||||||
incrementDonationCount++;
|
incrementDonationCount += incrementDonationCount;
|
||||||
setTimeout(riseDonationCount, 50);
|
setTimeout(riseDonationCount, 50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue