Fix .footer-fixed toggle and position

* See: https://github.com/next-theme/hexo-theme-next/pull/31
This commit is contained in:
Mimi 2023-03-04 12:23:06 +08:00
parent 81b4d077ea
commit 1501440d8d
3 changed files with 11 additions and 1 deletions

View File

@ -4,6 +4,8 @@
color: $grey-dark;
font-size: $font-size-small;
padding: 20px 0;
transition: $transition-ease;
transition-property: left, right;
&.footer-fixed {
bottom: 0;

View File

@ -4,6 +4,10 @@ if (hexo-config('sidebar.position') == 'right') {
// Otherwise a horizontal scrollbar will appear
+desktop-large() {
padding-right: $sidebar-desktop;
.footer-fixed {
right: $sidebar-desktop;
}
}
}
@ -18,6 +22,10 @@ if (hexo-config('sidebar.position') == 'right') {
.sidebar-active {
+desktop-large() {
padding-left: $sidebar-desktop;
.footer-fixed {
left: $sidebar-desktop;
}
}
}

View File

@ -50,7 +50,7 @@ document.addEventListener('DOMContentLoaded', () => {
function updateFooterPosition() {
const footer = document.querySelector('.footer');
const containerHeight = document.querySelector('.column').offsetHeight + document.querySelector('.main').offsetHeight + footer.offsetHeight;
const containerHeight = document.querySelector('.main').offsetHeight + footer.offsetHeight;
footer.classList.toggle('footer-fixed', containerHeight <= window.innerHeight);
}