mirror of
https://github.com/yv1ing/MollyBlog.git
synced 2025-09-16 14:53:45 +08:00
fix: Fixed some bugs
This commit is contained in:
@@ -9,6 +9,12 @@ if (localStorage.getItem("theme") === null) {
|
||||
replaceCssFile();
|
||||
setTheme();
|
||||
|
||||
window.addEventListener('resize', function() {
|
||||
setFooter()
|
||||
});
|
||||
|
||||
setFooter()
|
||||
|
||||
function changeTheme() {
|
||||
if (theme === "dark") {
|
||||
theme = "light";
|
||||
@@ -55,4 +61,29 @@ function replaceCssFile() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkSpecialHeight() {
|
||||
let element = document.querySelector('.body-container')
|
||||
if (!element) {
|
||||
return false;
|
||||
}
|
||||
let elementHeight = element.offsetHeight;
|
||||
let viewportHeight = window.innerHeight;
|
||||
|
||||
return elementHeight >= viewportHeight * 0.7;
|
||||
}
|
||||
|
||||
function setFooter() {
|
||||
try {
|
||||
if (checkSpecialHeight()) {
|
||||
document.querySelector('.footer').style.display = 'none';
|
||||
document.querySelector('.special-footer').style.display = 'block';
|
||||
} else {
|
||||
document.querySelector('.footer').style.display = 'block';
|
||||
document.querySelector('.special-footer').style.display = 'none';
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user