✨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);
|
||||
}
|
||||
}
|
||||
|
||||
+36
-36
@@ -10,41 +10,41 @@ import Navigation from './modules/Navigation.js';
|
||||
|
||||
// Add passive event listeners
|
||||
! function (e) {
|
||||
"function" == typeof define && define.amd ? define(e) : e()
|
||||
"function" == typeof define && define.amd ? define(e) : e()
|
||||
}(function () {
|
||||
let e;
|
||||
const t = ["scroll", "wheel", "touchstart", "touchmove", "touchenter", "touchend", "touchleave", "mouseout", "mouseleave", "mouseup", "mousedown", "mousemove", "mouseenter", "mousewheel", "mouseover"];
|
||||
if (function () {
|
||||
let e = !1;
|
||||
try {
|
||||
const t = Object.defineProperty({}, "passive", {
|
||||
get: function () {
|
||||
e = !0
|
||||
}
|
||||
});
|
||||
window.addEventListener("test", null, t);
|
||||
window.removeEventListener("test", null, t);
|
||||
} catch (e) { }
|
||||
return e
|
||||
}()) {
|
||||
const n = EventTarget.prototype.addEventListener;
|
||||
e = n;
|
||||
EventTarget.prototype.addEventListener = function (n, o, r) {
|
||||
let i;
|
||||
const s = "object" == typeof r && null !== r,
|
||||
u = s ? r.capture : r;
|
||||
if (s) {
|
||||
const t = Object.getOwnPropertyDescriptor(r, "passive");
|
||||
r = t && !0 !== t.writable && void 0 === t.set ? { ...r } : r;
|
||||
} else {
|
||||
r = {};
|
||||
}
|
||||
r.passive = void 0 !== (i = r.passive) ? i : -1 !== t.indexOf(n) && !0;
|
||||
r.capture = void 0 !== u && u;
|
||||
e.call(this, n, o, r);
|
||||
};
|
||||
EventTarget.prototype.addEventListener._original = e
|
||||
}
|
||||
let e;
|
||||
const t = ["scroll", "wheel", "touchstart", "touchmove", "touchenter", "touchend", "touchleave", "mouseout", "mouseleave", "mouseup", "mousedown", "mousemove", "mouseenter", "mousewheel", "mouseover"];
|
||||
if (function () {
|
||||
let e = !1;
|
||||
try {
|
||||
const t = Object.defineProperty({}, "passive", {
|
||||
get: function () {
|
||||
e = !0
|
||||
}
|
||||
});
|
||||
window.addEventListener("test", null, t);
|
||||
window.removeEventListener("test", null, t);
|
||||
} catch (e) { }
|
||||
return e
|
||||
}()) {
|
||||
const n = EventTarget.prototype.addEventListener;
|
||||
e = n;
|
||||
EventTarget.prototype.addEventListener = function (n, o, r) {
|
||||
let i;
|
||||
const s = "object" == typeof r && null !== r,
|
||||
u = s ? r.capture : r;
|
||||
if (s) {
|
||||
const t = Object.getOwnPropertyDescriptor(r, "passive");
|
||||
r = t && !0 !== t.writable && void 0 === t.set ? { ...r } : r;
|
||||
} else {
|
||||
r = {};
|
||||
}
|
||||
r.passive = void 0 !== (i = r.passive) ? i : -1 !== t.indexOf(n) && !0;
|
||||
r.capture = void 0 !== u && u;
|
||||
e.call(this, n, o, r);
|
||||
};
|
||||
EventTarget.prototype.addEventListener._original = e
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -69,8 +69,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
GetHeaderHeight();
|
||||
|
||||
// Add Back to Top button to body
|
||||
const backToTop = document.createElement('back-to-top');
|
||||
document.body.appendChild(backToTop);
|
||||
// const backToTop = document.createElement('x-back-to-top');
|
||||
// document.body.appendChild(backToTop);
|
||||
});
|
||||
|
||||
console.log(`theme.js loaded.`);
|
||||
|
||||
Reference in New Issue
Block a user