mirror of
https://github.com/Kugelschieber/schnittfest.git
synced 2026-11-12 09:02:01 +01:00
New design.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
let observer = null;
|
||||
|
||||
function getObserver() {
|
||||
if (!observer) {
|
||||
observer = new IntersectionObserver((entries) => {
|
||||
entries.forEach((entry) => {
|
||||
if (entry.isIntersecting) {
|
||||
entry.target.classList.add("is-visible");
|
||||
observer.unobserve(entry.target);
|
||||
}
|
||||
});
|
||||
}, { rootMargin: "0px 0px -8% 0px", threshold: 0.05 });
|
||||
}
|
||||
|
||||
return observer;
|
||||
}
|
||||
|
||||
export function initReveal(el) {
|
||||
if (!("IntersectionObserver" in window)) {
|
||||
el.classList.add("is-visible");
|
||||
return;
|
||||
}
|
||||
|
||||
getObserver().observe(el);
|
||||
}
|
||||
Reference in New Issue
Block a user