Skip to content

Commit a3192dc

Browse files
committed
fix: adjust intersection observer threshold for sticky class toggle
1 parent e811756 commit a3192dc

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/core/event/index.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,17 @@ export function Events(Base) {
5757
return;
5858
}
5959

60-
const observer = new IntersectionObserver(entries => {
61-
const isIntersecting = entries[0].isIntersecting;
62-
const op = isIntersecting ? 'remove' : 'add';
60+
const observer = new IntersectionObserver(
61+
entries => {
62+
const isIntersecting = entries[0].isIntersecting;
63+
const op = isIntersecting ? 'remove' : 'add';
6364

64-
dom.toggleClass(dom.body, op, 'sticky');
65-
});
65+
dom.toggleClass(dom.body, op, 'sticky');
66+
},
67+
{
68+
threshold: 0.01,
69+
},
70+
);
6671

6772
observer.observe(coverElm);
6873
}

0 commit comments

Comments
 (0)