Controls track scroll
This commit is contained in:
@@ -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}
|
||||
>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user