添加 header 栏的移动端样式

This commit is contained in:
MeiK
2020-12-16 11:30:44 +08:00
parent 5c70eabd64
commit b2509ea598
4 changed files with 63 additions and 25 deletions

View File

@@ -322,12 +322,3 @@ function setRelativeTime() {
elem.setAttribute('title', new Date(dateStr).toLocaleString());
});
}
window.onscroll = function (e) {
const headerImg = document.querySelector('#headerImg');
if (headerImg.getBoundingClientRect().bottom <= 0) {
document.querySelector('#headerStuck').classList.add('is-stuck');
} else {
document.querySelector('#headerStuck').classList.remove('is-stuck');
}
};