Finetuning scroll to top button
This commit is contained in:
parent
3b05195434
commit
6ecb27ffa7
|
|
@ -8,7 +8,7 @@ export function ScrollToTopButton() {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleScroll = () => {
|
const handleScroll = () => {
|
||||||
if (window.scrollY > 2 * window.innerHeight) {
|
if (window.scrollY > 1.5 * window.innerHeight) {
|
||||||
setIsVisible(true);
|
setIsVisible(true);
|
||||||
} else {
|
} else {
|
||||||
setIsVisible(false);
|
setIsVisible(false);
|
||||||
|
|
@ -23,8 +23,6 @@ export function ScrollToTopButton() {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
|
||||||
{isVisible && (
|
|
||||||
<Button
|
<Button
|
||||||
onClick={scrollToTop}
|
onClick={scrollToTop}
|
||||||
style={{
|
style={{
|
||||||
|
|
@ -34,12 +32,13 @@ export function ScrollToTopButton() {
|
||||||
borderRadius: '50%',
|
borderRadius: '50%',
|
||||||
width: '50px',
|
width: '50px',
|
||||||
height: '50px',
|
height: '50px',
|
||||||
zIndex: 999
|
zIndex: 999,
|
||||||
|
transition: 'opacity 0.5s ease-in-out',
|
||||||
|
opacity: isVisible ? 0.7 : 0,
|
||||||
|
pointerEvents: isVisible ? 'auto' : 'none'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon icon={faArrowUp} />
|
<FontAwesomeIcon icon={faArrowUp} />
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue