Please help! Why this method works in normal build and in ssr does not work.
error: IntersectionObserver is not defined
const animatedScrollObserver = new IntersectionObserver(
(entries, animatedScrollObserver) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
entry.target.classList.add('enter');
animatedScrollObserver.unobserve(entry.target);
}
});
}
);
export default boot(async ({ app }) => {
app.directive('scrollanimation', {
beforeMount(el) {
el.classList.add('before-enter');
animatedScrollObserver.observe(el);
}
})
})