Dashboard Temp Share Shortlinks Frames API

HTMLify

script.js
Views: 35 | Author: karbonsites
 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
40
41
42
43
44
45
46
47
48
49
document.addEventListener('DOMContentLoaded', () => {
    // 1. Setup Intersection Observer for Scroll Animations
    const observerOptions = {
        root: null,
        rootMargin: '0px',
        threshold: 0.1 
    };

    const observer = new IntersectionObserver((entries, observer) => {
        entries.forEach(entry => {
            if (entry.isIntersecting) {
                entry.target.classList.add('visible');
                observer.unobserve(entry.target);
            }
        });
    }, observerOptions);

    document.querySelectorAll('.fade-in, .fade-in-delay-1, .fade-in-delay-2, .fade-in-delay-3').forEach(element => {
        observer.observe(element);
    });
    
    // Manually trigger visibility for hero elements on load
    document.querySelector('.hero').classList.add('visible');
    if (document.querySelector('.about-hero')) {
        document.querySelector('.about-hero').classList.add('visible');
    }

    // 2. Handle Slider Input Feedback
    const volumeSlider = document.getElementById('volume-slider');
    const volumeValueSpan = document.getElementById('volume-value');

    if (volumeSlider && volumeValueSpan) {
        volumeSlider.addEventListener('input', (e) => {
            volumeValueSpan.textContent = e.target.value;
        });
    }

    // 3. Simple Button Click Feedback (Optional: for demonstration)
    document.querySelectorAll('.btn:not([disabled])').forEach(button => {
        button.addEventListener('click', (e) => {
            // Prevent the button from immediately losing the hover/active state if it causes a re-render
            if (e.target.classList.contains('icon-btn')) {
                console.log('Icon button clicked!');
            } else {
                console.log(`${e.target.textContent.trim().replace(/\s+/g, ' ')} button clicked.`);
            }
        });
    });
});