mirror of
https://github.com/imfing/hextra.git
synced 2025-07-01 10:47:18 -04:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
cb09b7ce1e | |||
96c6ff073f |
@ -1,18 +1,22 @@
|
||||
const backToTop = document.querySelector("#backToTop");
|
||||
// Back to top button
|
||||
|
||||
document.addEventListener("scroll", (event) => {
|
||||
if (window.scrollY > 300) {
|
||||
backToTop.classList.remove("opacity-0");
|
||||
} else {
|
||||
backToTop.classList.add("opacity-0");
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const backToTop = document.querySelector("#backToTop");
|
||||
if (backToTop) {
|
||||
document.addEventListener("scroll", (e) => {
|
||||
if (window.scrollY > 300) {
|
||||
backToTop.classList.remove("opacity-0");
|
||||
} else {
|
||||
backToTop.classList.add("opacity-0");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function scrollUp() {
|
||||
window.scroll({
|
||||
top: 0,
|
||||
left: 0,
|
||||
behavior: 'smooth'
|
||||
top: 0,
|
||||
left: 0,
|
||||
behavior: "smooth",
|
||||
});
|
||||
}
|
||||
|
@ -12,4 +12,6 @@ onThisPage: "此页上"
|
||||
editThisPage: "在 GitHub 上编辑此页 →"
|
||||
lastUpdated: "最后更新于"
|
||||
|
||||
backToTop: "返回顶部"
|
||||
|
||||
copyright: "© 2023 Hextra Project."
|
||||
|
Reference in New Issue
Block a user