renaming file
This commit is contained in:
parent
1f5de90b4f
commit
92e8c6ab1f
|
|
@ -1,26 +0,0 @@
|
|||
function handleScrollButonDisplay() {
|
||||
const scrollerTop = document.querySelector('#scroller-top');
|
||||
|
||||
if (
|
||||
document.body.scrollTop > window.innerHeight / 2 ||
|
||||
document.documentElement.scrollTop > window.innerHeight / 2
|
||||
) {
|
||||
scrollerTop.removeAttribute('aria-hidden');
|
||||
} else {
|
||||
scrollerTop.setAttribute('aria-hidden', 'true');
|
||||
}
|
||||
}
|
||||
function scrollTop() {
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
}
|
||||
|
||||
export default function scrollerTopInit() {
|
||||
const scrollerTop = document.querySelector('#scroller-top');
|
||||
if (!scrollerTop) return;
|
||||
|
||||
window.addEventListener('scroll', handleScrollButonDisplay);
|
||||
scrollerTop.addEventListener('click', scrollTop);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user