Skip to content

Commit

Permalink
Fix .footer-fixed toggle and position
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang authored and gtn1024 committed Jul 20, 2023
1 parent ed39710 commit 7aefa44
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions source/css/_common/outline/footer/index.styl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions source/css/_schemes/Muse/_sidebar.styl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand All @@ -18,6 +22,10 @@ if (hexo-config('sidebar.position') == 'right') {
.sidebar-active {
+desktop-large() {
padding-left: $sidebar-desktop;

.footer-fixed {
left: $sidebar-desktop;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion source/js/schemes/muse.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 7aefa44

Please sign in to comment.