| 123456789101112131415161718192021 |
- class IntersectionHandler {
- constructor() {
- this.el = null
- this.observer = null
- }
- setEl(el) {
- this.el = el
- }
- setObserver(onIntersect) {
- this.observer = new IntersectionObserver(onIntersect, {
- threshold: 0.80
- })
- }
- start() {
- this.observer.observe(this.el)
- }
- }
-
- const intersectionHandler = new IntersectionHandler()
-
- export { intersectionHandler }
|