mirror of
https://github.com/d3ward/toolz.git
synced 2024-11-10 17:25:04 +08:00
Update 404
This commit is contained in:
parent
6e51b389a2
commit
d9b161e6c7
1 changed files with 63 additions and 1 deletions
64
404.html
64
404.html
|
@ -173,6 +173,68 @@ background-image: linear-gradient(315deg, #f7b42c 0%, #fc575e 74%);
|
|||
</div>
|
||||
</main>
|
||||
</body>
|
||||
<script src="./src/js/script.js"></script>
|
||||
<script>
|
||||
|
||||
function aos() {
|
||||
const t = this;
|
||||
t.items = document.querySelectorAll("[class*=_aos]");
|
||||
if (IntersectionObserver && t.items) {
|
||||
let callback = function (entries) {
|
||||
entries.forEach(entry => {
|
||||
if (entry.isIntersecting && !entry.target.classList.contains('_aos-done')) {
|
||||
entry.target.classList.add('_aos-done');
|
||||
} else {
|
||||
entry.target.classList.remove('_aos-done');
|
||||
}
|
||||
});
|
||||
}
|
||||
let observer = new IntersectionObserver(callback, {
|
||||
root: null,
|
||||
threshold: 0
|
||||
});
|
||||
t.items.forEach((item) => {
|
||||
observer.observe(item);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function gotop() {
|
||||
var t = this;
|
||||
t.gt = document.getElementById('gt-link');
|
||||
t.scrollToTop = function () {
|
||||
window.scroll({
|
||||
top: 0,
|
||||
left: 0,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
}
|
||||
t.listeners = function () {
|
||||
window.addEventListener("scroll", () => {
|
||||
let y = window.scrollY;
|
||||
if (y > 0) {
|
||||
t.gt.classList.remove("hidden");
|
||||
} else {
|
||||
t.gt.classList.add("hidden");
|
||||
}
|
||||
});
|
||||
t.gt.onclick = function (e) {
|
||||
e.preventDefault();
|
||||
if (document.documentElement.scrollTop || document.body.scrollTop > 0) {
|
||||
t.scrollToTop();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (t.gt) {
|
||||
t.listeners();
|
||||
}
|
||||
}
|
||||
|
||||
// Call the function when the DOM is loaded
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
|
||||
new gotop();
|
||||
new aos();
|
||||
});
|
||||
</script>
|
||||
|
||||
</html>
|
Loading…
Reference in a new issue