From 4e8be38304ad5fcf64c585f42afef46c72adabb7 Mon Sep 17 00:00:00 2001 From: Luffy Date: Thu, 4 Dec 2025 14:01:59 +0800 Subject: [PATCH] fix: adjust intersection observer threshold for sticky class toggle (#2637) --- src/core/event/index.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/core/event/index.js b/src/core/event/index.js index ed514816..9d7a1b3b 100644 --- a/src/core/event/index.js +++ b/src/core/event/index.js @@ -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); }