Files
parts_website/static/js/pages/core/home.js

61 lines
1.5 KiB
JavaScript

// internal
import BasePage from "../base.js";
// external
import AOS from 'aos';
export default class PageHome extends BasePage {
static hash = hashPageHome;
constructor(router) {
super(router);
}
initialize() {
this.sharedInitialize();
this.hookupButtonsNavContact();
// this.initialiseAOS();
this.initialiseAnimations();
}
/* AOS */
initialiseAOS() {
AOS.init({
duration: 1000,
once: true,
});
}
/* Manual animations *
initialiseAnimations() {
// Check if IntersectionObserver is supported
if ('IntersectionObserver' in window) {
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('active');
}
});
}, {
threshold: 0.1,
rootMargin: '50px'
});
// Observe all elements with 'reveal' class
document.querySelectorAll('.reveal').forEach((element) => {
observer.observe(element);
});
} else {
// If IntersectionObserver is not supported, make all elements visible
document.querySelectorAll('.reveal').forEach((element) => {
element.style.opacity = 1;
});
}
}
*/
leave() {
super.leave();
}
}