File size: 888 Bytes
d7e9e46 | 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 | // Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// Flash control functions
let torchState = false;
function toggleTorch() {
if (typeof navigator !== 'undefined' && navigator.camera) {
torchState = !torchState;
navigator.camera.torch(torchState);
} else {
console.log('Torch toggled (simulated)');
// Simulate visual feedback for demo
document.body.style.backgroundColor = torchState ? '#ffff00' : '#111827';
torchState = !torchState;
}
}
// Form validation would go here
document.addEventListener('DOMContentLoaded', () => {
// Future form validation logic
});
|