Fix confirmation scroll to work reliably on repeat submissions
This commit is contained in:
@@ -204,8 +204,10 @@
|
|||||||
parts.push(`Thank you for your $${donatedAmount.toFixed(2)} donation!`);
|
parts.push(`Thank you for your $${donatedAmount.toFixed(2)} donation!`);
|
||||||
}
|
}
|
||||||
if (parts.length) {
|
if (parts.length) {
|
||||||
document.getElementById('thank-you').textContent = parts.join(' ');
|
const el = document.getElementById('thank-you');
|
||||||
document.getElementById('thank-you').style.display = 'block';
|
el.textContent = parts.join(' ');
|
||||||
|
el.style.display = 'block';
|
||||||
|
setTimeout(() => window.scrollTo({ top: 0, behavior: 'smooth' }), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,7 +216,6 @@
|
|||||||
const numPeopleParam = params.get('num_people');
|
const numPeopleParam = params.get('num_people');
|
||||||
if (donatedParam || numPeopleParam) {
|
if (donatedParam || numPeopleParam) {
|
||||||
showConfirmation(parseInt(numPeopleParam) || 0, donatedParam ? parseFloat(donatedParam) : null);
|
showConfirmation(parseInt(numPeopleParam) || 0, donatedParam ? parseFloat(donatedParam) : null);
|
||||||
document.getElementById('thank-you').scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
||||||
history.replaceState({}, '', location.pathname);
|
history.replaceState({}, '', location.pathname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user