39 lines
914 B
JavaScript
39 lines
914 B
JavaScript
const tl = gsap.timeline({
|
|
defaults: {
|
|
duration: 1,
|
|
y: -14,
|
|
opacity: 0,
|
|
ease: 'power4.out',
|
|
},
|
|
});
|
|
|
|
function pageHeaderAnimationInit() {
|
|
const contentElements = document.querySelectorAll(
|
|
'.page-header .page-header__content *',
|
|
);
|
|
const cover = document.querySelector('.page-header__image');
|
|
|
|
if (contentElements.length > 0) {
|
|
tl.from(contentElements, {}, '<');
|
|
}
|
|
if (cover) {
|
|
tl.from(cover, { delay: 0.2 }, '<');
|
|
}
|
|
}
|
|
|
|
function chapterSectionAnimationInit() {
|
|
const contentElements = document.querySelectorAll(
|
|
'.wp-block-carhop-blocks-chapter-section .chapter-section__content *',
|
|
);
|
|
const cover = document.querySelector('.chapter-section__cover');
|
|
|
|
if (contentElements.length > 0) {
|
|
tl.from(contentElements, {}, '<');
|
|
}
|
|
if (cover) {
|
|
tl.from(cover, { delay: 0.2 }, '<');
|
|
}
|
|
}
|
|
|
|
export { pageHeaderAnimationInit, chapterSectionAnimationInit };
|