perf: optimizing page transition (#178)

* perf: optimizing page transition

* fix: minor fixes
This commit is contained in:
saica.go
2024-09-13 20:14:03 +08:00
committed by GitHub
parent f5ad1c643d
commit f0754cae3f
9 changed files with 149 additions and 78 deletions

View File

@@ -44,14 +44,4 @@ import { Icon } from 'astro-icon/components'
function backToTop() {
window.scroll({ top: 0, behavior: 'smooth' });
}
function scrollFunction() {
let btn = document.getElementById('back-to-top-btn');
if (document.body.scrollTop > 600 || document.documentElement.scrollTop > 600) {
btn.classList.remove('hide')
} else {
btn.classList.add('hide')
}
}
window.onscroll = scrollFunction
</script>