init infrait
This commit is contained in:
23
static/js/main.js
Normal file
23
static/js/main.js
Normal file
@@ -0,0 +1,23 @@
|
||||
(() => {
|
||||
const revealItems = document.querySelectorAll('.card, .price-card, .panel, .benefits-grid article, .faq-list details');
|
||||
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
entries.forEach((entry) => {
|
||||
if (entry.isIntersecting) {
|
||||
entry.target.style.opacity = '1';
|
||||
entry.target.style.transform = 'translateY(0)';
|
||||
observer.unobserve(entry.target);
|
||||
}
|
||||
});
|
||||
},
|
||||
{ threshold: 0.08 }
|
||||
);
|
||||
|
||||
revealItems.forEach((item, index) => {
|
||||
item.style.opacity = '0';
|
||||
item.style.transform = 'translateY(18px)';
|
||||
item.style.transition = `opacity .45s ease ${index * 0.03}s, transform .45s ease ${index * 0.03}s`;
|
||||
observer.observe(item);
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user