mirror of
https://github.com/docsifyjs/docsify.git
synced 2025-12-08 19:55:52 +00:00
fix: adjust intersection observer threshold for sticky class toggle (#2637)
This commit is contained in:
parent
b960519608
commit
4e8be38304
@ -57,12 +57,15 @@ export function Events(Base) {
|
||||
return;
|
||||
}
|
||||
|
||||
const observer = new IntersectionObserver(entries => {
|
||||
const isIntersecting = entries[0].isIntersecting;
|
||||
const op = isIntersecting ? 'remove' : 'add';
|
||||
const observer = new IntersectionObserver(
|
||||
entries => {
|
||||
const isIntersecting = entries[0].isIntersecting;
|
||||
const op = isIntersecting ? 'remove' : 'add';
|
||||
|
||||
dom.body.classList[op]('sticky');
|
||||
});
|
||||
dom.body.classList[op]('sticky');
|
||||
},
|
||||
{ threshold: 0.01 },
|
||||
);
|
||||
|
||||
observer.observe(coverElm);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user