37 lines
1.4 KiB
JavaScript

// Changemaker Lite - Minimal Interactions
document.addEventListener('DOMContentLoaded', function() {
// Terminal copy functionality
const terminals = document.querySelectorAll('.terminal-box');
terminals.forEach(terminal => {
terminal.addEventListener('click', function() {
const code = this.textContent.trim();
navigator.clipboard.writeText(code).then(() => {
// Quick visual feedback
this.style.background = '#0a0a0a';
setTimeout(() => {
this.style.background = '#000';
}, 200);
});
});
});
// Smooth scroll for anchors
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
target.scrollIntoView({ behavior: 'smooth', block: 'start' });
}
});
});
// Reduced motion support
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
document.documentElement.style.scrollBehavior = 'auto';
const style = document.createElement('style');
style.textContent = '*, *::before, *::after { animation: none !important; transition: none !important; }';
document.head.appendChild(style);
}
});