fix: Fixed some bugs

This commit is contained in:
2025-01-14 21:30:25 +08:00
parent a87eaec245
commit 859a7ec6fe
7 changed files with 69 additions and 5 deletions

View File

@@ -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) {
}
}