✨feature: Refactor footer layout and styles for improved design consistency
Sync TODOs with Issues / sync_todos (push) Successful in 6s
Sync TODOs with Issues / sync_todos (push) Successful in 6s
This commit is contained in:
@@ -2,23 +2,21 @@
|
||||
class BackToTopButton extends HTMLElement {
|
||||
connectedCallback() {
|
||||
this.innerHTML = `
|
||||
<button id="backToTopBtn" aria-label="Back to top" class="back-to-top" style="">
|
||||
↑ Top
|
||||
</button>
|
||||
<button id="backToTopBtn" aria-label="Back to top" class="back-to-top" style=""><i class="icon-arrow-upward"></i></button>
|
||||
`;
|
||||
|
||||
const btn = this.querySelector('#backToTopBtn');
|
||||
|
||||
let previousScrollY = window.scrollY;
|
||||
// let previousScrollY = window.scrollY;
|
||||
|
||||
window.addEventListener('scroll', () => {
|
||||
const currentScrollY = window.scrollY;
|
||||
const isScrollingUp = currentScrollY < previousScrollY;
|
||||
const shouldShowButton = currentScrollY > 300 && isScrollingUp;
|
||||
// window.addEventListener('scroll', () => {
|
||||
// const currentScrollY = window.scrollY;
|
||||
// const isScrollingUp = currentScrollY < previousScrollY;
|
||||
// const shouldShowButton = currentScrollY > 300 && isScrollingUp;
|
||||
|
||||
btn.style.display = shouldShowButton ? 'block' : 'none';
|
||||
previousScrollY = currentScrollY;
|
||||
});
|
||||
// btn.style.display = shouldShowButton ? 'block' : 'none';
|
||||
// previousScrollY = currentScrollY;
|
||||
// });
|
||||
|
||||
btn.addEventListener('click', () => {
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
@@ -27,7 +25,7 @@ class BackToTopButton extends HTMLElement {
|
||||
}
|
||||
|
||||
export function registerBackToTopButton() {
|
||||
if (!customElements.get('back-to-top')) {
|
||||
customElements.define('back-to-top', BackToTopButton);
|
||||
if (!customElements.get('x-back-to-top')) {
|
||||
customElements.define('x-back-to-top', BackToTopButton);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user