Spaces:
Running
Running
File size: 1,851 Bytes
51dad28 |
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 |
// Shared JavaScript across all pages
document.addEventListener('DOMContentLoaded', function() {
console.log('Wellness Wave App loaded');
// Time slider functionality
const timeSlider = document.getElementById('timeSlider');
const timeValue = document.getElementById('timeValue');
if (timeSlider && timeValue) {
timeSlider.addEventListener('input', function() {
timeValue.textContent = this.value;
});
}
// Form submission
const retreatForm = document.getElementById('retreatForm');
if (retreatForm) {
retreatForm.addEventListener('submit', function(e) {
e.preventDefault();
// Get form values
const time = timeSlider.value;
const areas = Array.from(document.querySelectorAll('input[name="areas"]:checked')).map(cb => cb.value);
const difficulty = document.querySelector('input[name="difficulty"]:checked').value;
// In a real app, this would send data to a server
console.log('Retreat Configuration:', { time, areas, difficulty });
// Show confirmation
alert(`Your personalized yoga retreat has been configured!\nDuration: ${time} minutes\nTarget Areas: ${areas.join(', ') || 'None selected'}\nDifficulty: ${difficulty}`);
});
}
// Smooth scrolling for anchor links
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'
});
}
});
});
}); |