bercovasile's picture
butonul de confitmate trebuie sa fie stiki
970b44c verified
document.addEventListener('DOMContentLoaded', function() {
const termsContainer = document.querySelector('.terms-container');
const checkbox = document.getElementById('agree-checkbox');
const continueBtn = document.getElementById('continue-btn');
const endOfTerms = document.getElementById('end-of-terms');
// Check if user has scrolled to the bottom
termsContainer.addEventListener('scroll', function() {
const scrollPosition = termsContainer.scrollTop + termsContainer.clientHeight;
const scrollHeight = termsContainer.scrollHeight;
// If scrolled to bottom (with 50px tolerance), enable checkbox
if (scrollPosition >= scrollHeight - 50) {
checkbox.disabled = false;
} else {
checkbox.disabled = true;
checkbox.checked = false;
continueBtn.disabled = true;
}
});
// Enable continue button when checkbox is checked
checkbox.addEventListener('change', function() {
continueBtn.disabled = !this.checked;
});
// Continue button functionality
continueBtn.addEventListener('click', function() {
if (!this.disabled) {
alert('Thank you for accepting our Terms & Conditions!');
// Here you would typically redirect to the next page
// window.location.href = '/next-page';
}
});
// Initial state
checkbox.disabled = true;
continueBtn.disabled = true;
});