From b20fd42eecb1f6187749180dee92b5327395e544 Mon Sep 17 00:00:00 2001 From: hzm <934585316@qq.com> Date: Sun, 8 Mar 2026 12:43:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A7=BB=E5=8A=A8=E7=AB=AF=E8=A1=A8?= =?UTF-8?q?=E5=A4=B4=E5=9B=BA=E5=AE=9A=E8=80=83=E8=99=91=E5=90=88=E8=AE=A1?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/MobileFundTable.jsx | 33 +++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/app/components/MobileFundTable.jsx b/app/components/MobileFundTable.jsx index 24d3bed..be2e95c 100644 --- a/app/components/MobileFundTable.jsx +++ b/app/components/MobileFundTable.jsx @@ -281,6 +281,7 @@ export default function MobileFundTable({ const [tableContainerWidth, setTableContainerWidth] = useState(0); const [isScrolled, setIsScrolled] = useState(false); const [showPortalHeader, setShowPortalHeader] = useState(false); + const [effectiveStickyTop, setEffectiveStickyTop] = useState(stickyTop); useEffect(() => { const el = tableContainerRef.current; @@ -294,13 +295,39 @@ export default function MobileFundTable({ useEffect(() => { if (typeof window === 'undefined') return; + const getEffectiveStickyTop = () => { + const stickySummaryCard = document.querySelector('.group-summary-sticky .group-summary-card'); + if (!stickySummaryCard) return stickyTop; + + const stickySummaryWrapper = stickySummaryCard.closest('.group-summary-sticky'); + if (!stickySummaryWrapper) return stickyTop; + + const wrapperRect = stickySummaryWrapper.getBoundingClientRect(); + const isSummaryStuck = wrapperRect.top <= stickyTop + 1; + + return isSummaryStuck ? stickyTop + stickySummaryWrapper.offsetHeight : stickyTop; + }; + const handleVerticalScroll = () => { - setShowPortalHeader(window.scrollY >= stickyTop); + const nextStickyTop = getEffectiveStickyTop(); + setEffectiveStickyTop((prev) => (prev === nextStickyTop ? prev : nextStickyTop)); + + const tableRect = tableContainerRef.current?.getBoundingClientRect(); + if (!tableRect) { + setShowPortalHeader(window.scrollY >= nextStickyTop); + return; + } + + setShowPortalHeader(tableRect.top <= nextStickyTop); }; handleVerticalScroll(); window.addEventListener('scroll', handleVerticalScroll, { passive: true }); - return () => window.removeEventListener('scroll', handleVerticalScroll); + window.addEventListener('resize', handleVerticalScroll, { passive: true }); + return () => { + window.removeEventListener('scroll', handleVerticalScroll); + window.removeEventListener('resize', handleVerticalScroll); + }; }, [stickyTop]); useEffect(() => { @@ -818,7 +845,7 @@ export default function MobileFundTable({ const renderContent = (onlyShowHeader) => { if (onlyShowHeader) { return ( -