Controls track scroll

This commit is contained in:
2022-05-19 23:29:58 +03:00
parent b3aa31a3f6
commit e0eed7f1f6
4 changed files with 34 additions and 27 deletions

View File

@@ -5,16 +5,15 @@ import styles from './Projects.module.css';
export default () => {
const [, { setVisibleChapter }] = useStore();
const [add] = createViewportObserver();
const [observer] = createViewportObserver({threshold: 0.9});
return (
<div
ref={el => {
add(el, (event) => {
console.log(event.isIntersecting);
<div
use:observer={(event) => {
if (event.isIntersecting) {
setVisibleChapter('projects');
});
}}
}}
}
class={styles.Projects}
>