Fix body.sidebar-active content width

This commit is contained in:
Mimi 2022-11-11 20:14:07 +08:00
parent c90f82ef4f
commit 0e79d308ed
3 changed files with 28 additions and 25 deletions

View File

@ -1,6 +1,8 @@
if (hexo-config('sidebar.position') == 'right') {
.sidebar-active {
+desktop() {
// Note: $sidebar-desktop + $content-desktop-large should be greater than desktop-large threshold
// Otherwise a horizontal scrollbar will appear
+desktop-large() {
padding-right: $sidebar-desktop;
}
}
@ -14,7 +16,7 @@ if (hexo-config('sidebar.position') == 'right') {
}
} else {
.sidebar-active {
+desktop() {
+desktop-large() {
padding-left: $sidebar-desktop;
}
}
@ -94,13 +96,7 @@ if (hexo-config('sidebar.position') == 'right') {
}
.sidebar-dimmer {
display: none;
}
+tablet-mobile() {
.sidebar-dimmer {
background: black;
display: block;
height: 100%;
left: 0;
opacity: 0;
@ -115,5 +111,10 @@ if (hexo-config('sidebar.position') == 'right') {
opacity: .7;
visibility: visible;
}
}
+desktop-large() {
.sidebar-dimmer {
display: none;
}
}

View File

@ -1,3 +1,5 @@
@import '_variables/base';
body { margin-top: 2rem; }
.use-motion .menu-item,
@ -30,7 +32,7 @@ body { margin-top: 2rem; }
.sidebar-panel { display: block; }
.noscript-warning {
background-color: #f55;
background-color: lighten($red, 20%);
color: white;
font-family: sans-serif;
font-size: 1rem;
@ -40,5 +42,5 @@ body { margin-top: 2rem; }
text-align: center;
top: 0;
width: 100%;
z-index: 50;
z-index: $zindex-5;
}

View File

@ -286,7 +286,7 @@ NexT.utils = {
},
updateSidebarPosition: function() {
if (window.innerWidth < 992 || CONFIG.scheme === 'Pisces' || CONFIG.scheme === 'Gemini') return;
if (window.innerWidth < 1200 || CONFIG.scheme === 'Pisces' || CONFIG.scheme === 'Gemini') return;
// Expand sidebar on post detail page by default, when post has a toc.
const hasTOC = document.querySelector('.post-toc');
let display = CONFIG.page.sidebar;