10 lines
308 B
JavaScript
10 lines
308 B
JavaScript
|
const scrollToTopButton = document.getElementById('totop');
|
||
|
const scrollToTopListener = () => {
|
||
|
if (window.scrollY > 0) {
|
||
|
scrollToTopButton.className = "totop show";
|
||
|
} else {
|
||
|
scrollToTopButton.className = "totop hide";
|
||
|
}
|
||
|
};
|
||
|
|
||
|
window.addEventListener("scroll", scrollToTopListener);
|