Mini Shell
document.addEventListener('DOMContentLoaded', () => {
// Intersection Observer for fade-in animations
const observerOptions = {
threshold: 0.2,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('active');
observer.unobserve(entry.target);
}
});
}, observerOptions);
// Observe all elements with fade-in class
document.querySelectorAll('.fade-in').forEach(el => observer.observe(el));
// Smooth scroll for navigation 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'
});
}
});
});
// Parallax effect for hero section
const hero = document.querySelector('.hero');
window.addEventListener('scroll', () => {
const scrolled = window.pageYOffset;
if (hero) {
hero.style.backgroundPositionY = `${scrolled * 0.5}px`;
}
});
// Add air particles dynamically to multiple sections
const addAirParticles = (section, count, isReverse = false) => {
if (section) {
for (let i = 0; i < count; i++) {
const particle = document.createElement('div');
// Randomly assign classes for variety
const sizeClasses = ['small', 'medium', 'large'];
const sizeClass = sizeClasses[Math.floor(Math.random() * sizeClasses.length)];
// Randomly make some particles blue
const isBlue = Math.random() > 0.6;
particle.className = `air-particle ${sizeClass}${isBlue ? ' blue' : ''}`;
// Set random width and height based on size class
let size;
if (sizeClass === 'small') size = Math.random() * 3 + 3;
else if (sizeClass === 'medium') size = Math.random() * 4 + 7;
else size = Math.random() * 5 + 12;
particle.style.width = `${size}px`;
particle.style.height = particle.style.width;
particle.style.left = `${Math.random() * 100}%`;
// Set animation properties
particle.style.animationName = isReverse ? 'floatReverse' : 'float';
particle.style.animationDuration = `${Math.random() * 15 + 10}s`;
particle.style.animationDelay = `${Math.random() * 8}s`;
section.appendChild(particle);
}
}
};
// Add particles to hero section
const heroSection = document.querySelector('.hero');
addAirParticles(heroSection, 20);
// Add particles to services section
const servicesSection = document.querySelector('.services');
addAirParticles(servicesSection, 12, true);
// Add particles to benefits section
const benefitsSection = document.querySelector('.benefits');
addAirParticles(benefitsSection, 15);
// Add particles to CTA section
const ctaSection = document.querySelector('.cta');
addAirParticles(ctaSection, 10, true);
// Add particles to footer section
const footerSection = document.querySelector('footer');
if (footerSection) {
const footerAirFlowContainer = document.querySelector('.footer-air-flow-container');
if (footerAirFlowContainer) {
for (let i = 0; i < 15; i++) {
const particle = document.createElement('div');
// Randomly assign classes for variety
const sizeClasses = ['small', 'medium', 'large'];
const sizeClass = sizeClasses[Math.floor(Math.random() * sizeClasses.length)];
// Randomly make some particles blue
const isBlue = Math.random() > 0.6;
particle.className = `footer-air-particle ${sizeClass}${isBlue ? ' blue' : ''}`;
// Set random width and height based on size class
let size;
if (sizeClass === 'small') size = Math.random() * 3 + 3;
else if (sizeClass === 'medium') size = Math.random() * 4 + 7;
else size = Math.random() * 5 + 12;
particle.style.width = `${size}px`;
particle.style.height = particle.style.width;
particle.style.left = `${Math.random() * 100}%`;
// Set animation properties
particle.style.animationDuration = `${Math.random() * 15 + 10}s`;
particle.style.animationDelay = `${Math.random() * 8}s`;
footerAirFlowContainer.appendChild(particle);
}
}
}
}
});