|
|
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'); |
|
|
|
|
|
|
|
|
termsContainer.addEventListener('scroll', function() { |
|
|
const scrollPosition = termsContainer.scrollTop + termsContainer.clientHeight; |
|
|
const scrollHeight = termsContainer.scrollHeight; |
|
|
|
|
|
|
|
|
if (scrollPosition >= scrollHeight - 50) { |
|
|
checkbox.disabled = false; |
|
|
} else { |
|
|
checkbox.disabled = true; |
|
|
checkbox.checked = false; |
|
|
continueBtn.disabled = true; |
|
|
} |
|
|
}); |
|
|
|
|
|
|
|
|
checkbox.addEventListener('change', function() { |
|
|
continueBtn.disabled = !this.checked; |
|
|
}); |
|
|
|
|
|
|
|
|
continueBtn.addEventListener('click', function() { |
|
|
if (!this.disabled) { |
|
|
alert('Thank you for accepting our Terms & Conditions!'); |
|
|
|
|
|
|
|
|
} |
|
|
}); |
|
|
|
|
|
|
|
|
checkbox.disabled = true; |
|
|
continueBtn.disabled = true; |
|
|
}); |