diff --git a/themes/next/components/JumpToBottomButton.js b/themes/next/components/JumpToBottomButton.js index 8da40c86..c54b7b59 100644 --- a/themes/next/components/JumpToBottomButton.js +++ b/themes/next/components/JumpToBottomButton.js @@ -18,10 +18,6 @@ const JumpToBottomButton = ({ showPercent = false }) => { return () => document.removeEventListener('scroll', scrollListener) }, [show]) - if (!CONFIG_NEXT.WIDGET_TO_BOTTOM) { - return <>> - } - const scrollListener = () => { const targetRef = document.getElementById('wrapper') const clientHeight = targetRef?.clientHeight @@ -41,6 +37,10 @@ const JumpToBottomButton = ({ showPercent = false }) => { window.scrollTo({ top: targetRef.clientHeight, behavior: 'smooth' }) } + if (!CONFIG_NEXT.WIDGET_TO_BOTTOM) { + return <>> + } + return (