Remove .container

This commit is contained in:
Mimi 2020-08-08 18:00:34 +08:00
parent acc5a74268
commit 9ec4d87ddc
5 changed files with 29 additions and 36 deletions

View File

@ -9,8 +9,7 @@
{{ partial('_scripts/noscript.njk', {}, {cache: theme.cache.enable}) }} {{ partial('_scripts/noscript.njk', {}, {cache: theme.cache.enable}) }}
</head> </head>
<body itemscope itemtype="http://schema.org/WebPage"> <body itemscope itemtype="http://schema.org/WebPage"{% if theme.motion.enable %} class="use-motion"{% endif %}>
<div class="container{%- if theme.motion.enable %} use-motion{%- endif %}">
<div class="headband"></div> <div class="headband"></div>
<main class="main"> <main class="main">
@ -39,7 +38,6 @@
{{ partial('_third-party/statistics/index.njk', {}, {cache: theme.cache.enable}) }} {{ partial('_third-party/statistics/index.njk', {}, {cache: theme.cache.enable}) }}
</div> </div>
</footer> </footer>
</div>
{{ partial('_scripts/index.njk', {}, {cache: theme.cache.enable}) }} {{ partial('_scripts/index.njk', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/index.njk', {}, {cache: theme.cache.enable}) }} {{ partial('_third-party/index.njk', {}, {cache: theme.cache.enable}) }}

View File

@ -1,8 +1,3 @@
.container {
min-height: 100%;
position: relative;
}
@import 'header'; @import 'header';
@import 'sidebar'; @import 'sidebar';
@import 'footer'; @import 'footer';

View File

@ -13,6 +13,8 @@ body {
font-family: $font-family-base; font-family: $font-family-base;
font-size: $font-size-base; font-size: $font-size-base;
line-height: $line-height-base; line-height: $line-height-base;
min-height: 100%;
position: relative;
transition: all $transition-ease; transition: all $transition-ease;
} }

View File

@ -1,7 +1,7 @@
if (hexo-config('sidebar.position') == 'right') { if (hexo-config('sidebar.position') == 'right') {
.sidebar-active { .sidebar-active {
+desktop() { +desktop() {
padding-right: $sidebar-desktop; margin-right: $sidebar-desktop;
} }
} }
@ -15,7 +15,7 @@ if (hexo-config('sidebar.position') == 'right') {
} else { } else {
.sidebar-active { .sidebar-active {
+desktop() { +desktop() {
padding-left: $sidebar-desktop; margin-left: $sidebar-desktop;
} }
} }

View File

@ -145,9 +145,7 @@ NexT.utils = {
// For init back to top in sidebar if page was scrolled after page refresh. // For init back to top in sidebar if page was scrolled after page refresh.
window.addEventListener('scroll', () => { window.addEventListener('scroll', () => {
if (backToTop || readingProgressBar) { if (backToTop || readingProgressBar) {
const docHeight = document.querySelector('.container').offsetHeight; const contentHeight = document.body.scrollHeight - window.innerHeight;
const winHeight = window.innerHeight;
const contentHeight = docHeight > winHeight ? docHeight - winHeight : document.body.scrollHeight - winHeight;
const scrollPercent = contentHeight > 0 ? Math.min(100 * window.scrollY / contentHeight, 100) : 0; const scrollPercent = contentHeight > 0 ? Math.min(100 * window.scrollY / contentHeight, 100) : 0;
if (backToTop) { if (backToTop) {
backToTop.classList.toggle('back-to-top-on', Math.round(scrollPercent) >= 5); backToTop.classList.toggle('back-to-top-on', Math.round(scrollPercent) >= 5);