File size: 3,309 Bytes
0d2d0a5 65931c3 71dc1a1 65931c3 0d2d0a5 71dc1a1 |
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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
// Expandable content functionality
function setupExpandableButtons() {
document.querySelectorAll('.expandable-button').forEach(button => {
button.addEventListener('click', function() {
const contentId = this.getAttribute('data-target');
const content = document.getElementById(contentId);
const icon = this.querySelector('i');
// Toggle active class
content.classList.toggle('active');
// Update icon and aria attributes
const isExpanded = content.classList.contains('active');
this.setAttribute('aria-expanded', isExpanded);
if (isExpanded) {
icon.setAttribute('data-feather', 'chevron-up');
} else {
icon.setAttribute('data-feather', 'chevron-down');
}
feather.replace();
});
});
}
// Mobile menu toggle functionality
document.addEventListener('DOMContentLoaded', function() {
setupExpandableButtons();
// FAQ toggle functionality
document.querySelectorAll('[data-feather="chevron-down"]').forEach(icon => {
const button = icon.parentElement;
const content = button.nextElementSibling;
button.addEventListener('click', () => {
const isExpanded = content.classList.toggle('hidden');
if (isExpanded) {
icon.setAttribute('data-feather', 'chevron-down');
} else {
icon.setAttribute('data-feather', 'chevron-up');
}
feather.replace();
});
});
// Initialize Feather Icons
feather.replace();
// Mobile menu toggle (will be added to navbar component)
const mobileMenuBtn = document.querySelector('.mobile-menu-btn');
const navLinks = document.querySelector('.nav-links');
if (mobileMenuBtn && navLinks) {
mobileMenuBtn.addEventListener('click', function() {
navLinks.style.display = navLinks.style.display === 'flex' ? 'none' : 'flex';
});
}
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
const targetId = this.getAttribute('href');
if (targetId === '#') return;
const targetElement = document.querySelector(targetId);
if (targetElement) {
targetElement.scrollIntoView({
behavior: 'smooth'
});
}
});
});
// Add animation class when elements come into view
const animateOnScroll = function() {
const elements = document.querySelectorAll('.card-hover, .fade-in');
elements.forEach(element => {
const elementPosition = element.getBoundingClientRect().top;
const screenPosition = window.innerHeight / 1.2;
if (elementPosition < screenPosition) {
element.classList.add('animate');
}
});
};
window.addEventListener('scroll', animateOnScroll);
animateOnScroll(); // Run once on page load
}); |