Merge pull request #125 from yuweizzz/perf-user-profile

perf: adjust avatar position when in different box
This commit is contained in:
MeiK
2023-09-18 10:59:27 +08:00
committed by GitHub

View File

@@ -189,12 +189,19 @@
<script> <script>
window.onscroll = function (e) { window.onscroll = function (e) {
const headerImg = document.querySelector('#headerImg'); const headerImg = document.querySelector('#headerImg');
const headerStuck = document.querySelector('#headerStuck');
if (headerImg.getBoundingClientRect().bottom <= 0) { if (headerImg.getBoundingClientRect().bottom <= 0) {
document.querySelector('#headerStuck').classList.add('is-stuck'); headerStuck.classList.add('is-stuck');
if (window.innerWidth >= 1280) {
headerStuck.setAttribute('style', 'top: 12px;')
} else {
headerStuck.setAttribute('style', 'top: 0;')
}
} else { } else {
document.querySelector('#headerStuck').classList.remove('is-stuck'); headerStuck.classList.remove('is-stuck');
} }
}; };
var style = localStorage.getItem('data-color-mode'); var style = localStorage.getItem('data-color-mode');
iconElement = document.getElementById('github-icon'); iconElement = document.getElementById('github-icon');
if (style == 'light') { if (style == 'light') {