mirror of
https://github.com/d3ward/toolz.git
synced 2024-09-20 14:56:17 +08:00
Update 404
This commit is contained in:
parent
6e51b389a2
commit
d9b161e6c7
64
404.html
64
404.html
|
@ -173,6 +173,68 @@ background-image: linear-gradient(315deg, #f7b42c 0%, #fc575e 74%);
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</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>
|
</html>
|
Loading…
Reference in a new issue