diff --git a/wp-content/themes/dekart/assets/js/camp.js b/wp-content/themes/dekart/assets/js/camp.js index 694ff6e..a45ccc3 100644 --- a/wp-content/themes/dekart/assets/js/camp.js +++ b/wp-content/themes/dekart/assets/js/camp.js @@ -88,3 +88,49 @@ document.addEventListener('DOMContentLoaded', function() { card.style.transitionDelay = (i * 0.1) + 's'; }); }); + +// Scroll animation: all sections +(function() { + const animatedSections = [ + '.hero-media-search__container', + '.about-us__wrapper', + '.suggestions h2', + '.suggestions__subtitle', + '.suggestions__item', + '.infograph h2', + '.infograph .camp_text', + '.infograph-wrapper', + '.programs h2', + '.programs__subtitle', + '.programs-wrapper > div', + '.mentors h2', + '.mentors-wrapper > div', + '.routine h2', + '.routine__item', + '.foto h2', + '.camp-foto-wrapper', + '.camp-reviews-wrapper', + '.camp-faq h2', + '.faq-wrapper', + '.camp-contact h2', + '.contact-wrapper', + ].join(','); + + const observer2 = new IntersectionObserver((entries) => { + entries.forEach(entry => { + if (entry.isIntersecting) { + entry.target.classList.add('visible'); + } + }); + }, { threshold: 0.1, rootMargin: '0px 0px -50px 0px' }); + + document.querySelectorAll(animatedSections).forEach(el => { + el.classList.add('fade-up'); + observer2.observe(el); + }); + + // Stagger for cards + document.querySelectorAll('.suggestions__item, .routine__item, .programs-wrapper > div, .mentors-wrapper > div').forEach((card, i) => { + card.style.transitionDelay = (i * 0.08) + 's'; + }); +})();