![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/.cursor-server/data/User/History/68bf9d76/ |
/**
* Homepage - Interactive Features
*/
// Animated Counter
function animateCounter(element, target, duration = 2000) {
const start = 0;
const increment = target / (duration / 16);
let current = start;
const timer = setInterval(() => {
current += increment;
if (current >= target) {
element.textContent = Math.floor(target);
clearInterval(timer);
} else {
element.textContent = Math.floor(current);
}
}, 16);
}
// Initialize counters when in view
const observerOptions = {
threshold: 0.5,
rootMargin: '0px'
};
const counterObserver = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting && !entry.target.classList.contains('counted')) {
entry.target.classList.add('counted');
const target = parseInt(entry.target.getAttribute('data-target')) || 0;
animateCounter(entry.target, target);
}
});
}, observerOptions);
// Observe all stat numbers
document.querySelectorAll('.stat-number').forEach(stat => {
counterObserver.observe(stat);
});
// Scroll animations
const fadeObserver = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('visible');
}
});
}, {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
});
// Add fade-in class to sections
document.querySelectorAll('.step-card, .value-card, .testimonial-card, .dimension-card').forEach(el => {
el.classList.add('fade-in');
fadeObserver.observe(el);
});
// Interactive dimension cards
document.querySelectorAll('.interactive-card').forEach(card => {
card.addEventListener('mouseenter', function() {
this.style.transform = 'translateY(-10px) scale(1.02)';
});
card.addEventListener('mouseleave', function() {
this.style.transform = 'translateY(0) scale(1)';
});
// Add click ripple effect
card.addEventListener('click', function(e) {
const ripple = document.createElement('div');
ripple.style.cssText = `
position: absolute;
border-radius: 50%;
background: rgba(233, 69, 96, 0.3);
transform: scale(0);
animation: ripple 0.6s ease-out;
pointer-events: none;
`;
const rect = this.getBoundingClientRect();
const size = Math.max(rect.width, rect.height);
ripple.style.width = ripple.style.height = size + 'px';
ripple.style.left = (e.clientX - rect.left - size / 2) + 'px';
ripple.style.top = (e.clientY - rect.top - size / 2) + 'px';
this.appendChild(ripple);
setTimeout(() => ripple.remove(), 600);
});
});
// Add ripple animation
const style = document.createElement('style');
style.textContent = `
@keyframes ripple {
to {
transform: scale(2);
opacity: 0;
}
}
`;
document.head.appendChild(style);
// Parallax effect for hero
let lastScroll = 0;
window.addEventListener('scroll', () => {
const hero = document.querySelector('.hero');
if (hero) {
const scrolled = window.pageYOffset;
const parallax = scrolled * 0.5;
hero.style.transform = `translateY(${parallax}px)`;
}
});
// Smooth scroll 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) {
const offsetTop = target.offsetTop - 80;
window.scrollTo({
top: offsetTop,
behavior: 'smooth'
});
}
});
});
// Dynamic typing effect for hero (optional)
function typeWriter(element, text, speed = 50) {
let i = 0;
element.textContent = '';
function type() {
if (i < text.length) {
element.textContent += text.charAt(i);
i++;
setTimeout(type, speed);
}
}
type();
}
// Add particle effect to hero background (optional enhancement)
function createParticles() {
const hero = document.querySelector('.hero-background');
if (!hero) return;
for (let i = 0; i < 20; i++) {
const particle = document.createElement('div');
particle.style.cssText = `
position: absolute;
width: 2px;
height: 2px;
background: rgba(233, 69, 96, 0.5);
border-radius: 50%;
left: ${Math.random() * 100}%;
top: ${Math.random() * 100}%;
animation: float-particle ${5 + Math.random() * 5}s infinite ease-in-out;
animation-delay: ${Math.random() * 2}s;
`;
hero.appendChild(particle);
}
const particleStyle = document.createElement('style');
particleStyle.textContent = `
@keyframes float-particle {
0%, 100% {
transform: translate(0, 0);
opacity: 0.5;
}
50% {
transform: translate(${Math.random() * 100 - 50}px, ${Math.random() * 100 - 50}px);
opacity: 1;
}
}
`;
document.head.appendChild(particleStyle);
}
// Initialize on load
document.addEventListener('DOMContentLoaded', () => {
createParticles();
console.log('🌐 Free Village Network - Homepage Interactive Features Loaded');
});