File size: 1,479 Bytes
68c87a3
970b44c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d55dbaa
970b44c
 
 
 
 
 
68c87a3
970b44c
 
 
 
 
 
 
68c87a3
970b44c
 
 
 
68c87a3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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;
});