From 9ec4d87ddc41b32d9bd5728298fe34b6595726d2 Mon Sep 17 00:00:00 2001 From: Mimi <1119186082@qq.com> Date: Sat, 8 Aug 2020 18:00:34 +0800 Subject: [PATCH] Remove .container --- layout/_layout.njk | 50 ++++++++++++------------ source/css/_common/outline/outline.styl | 5 --- source/css/_common/scaffolding/base.styl | 2 + source/css/_schemes/Muse/_sidebar.styl | 4 +- source/js/utils.js | 4 +- 5 files changed, 29 insertions(+), 36 deletions(-) diff --git a/layout/_layout.njk b/layout/_layout.njk index 78ae5cd..60f14e9 100644 --- a/layout/_layout.njk +++ b/layout/_layout.njk @@ -9,37 +9,35 @@ {{ partial('_scripts/noscript.njk', {}, {cache: theme.cache.enable}) }} - -
-
+ +
-
-
-
{% include '_partials/header/index.njk' %}
- {%- if theme.sidebar.display !== 'remove' %} - {% block sidebar %}{% endblock %} - {%- endif %} -
+
+
+
{% include '_partials/header/index.njk' %}
+ {%- if theme.sidebar.display !== 'remove' %} + {% block sidebar %}{% endblock %} + {%- endif %} +
- {{ partial('_partials/widgets.njk', {}, {cache: theme.cache.enable}) }} + {{ partial('_partials/widgets.njk', {}, {cache: theme.cache.enable}) }} -
- {% include '_partials/header/sub-menu.njk' %} -
- {% block content %}{% endblock %} -
- {% include '_partials/comments.njk' %} +
+ {% include '_partials/header/sub-menu.njk' %} +
+ {% block content %}{% endblock %}
-
+ {% include '_partials/comments.njk' %} +
+ - - + {{ partial('_scripts/index.njk', {}, {cache: theme.cache.enable}) }} {{ partial('_third-party/index.njk', {}, {cache: theme.cache.enable}) }} diff --git a/source/css/_common/outline/outline.styl b/source/css/_common/outline/outline.styl index 3762767..8c3d532 100644 --- a/source/css/_common/outline/outline.styl +++ b/source/css/_common/outline/outline.styl @@ -1,8 +1,3 @@ -.container { - min-height: 100%; - position: relative; -} - @import 'header'; @import 'sidebar'; @import 'footer'; diff --git a/source/css/_common/scaffolding/base.styl b/source/css/_common/scaffolding/base.styl index 118e457..8751730 100644 --- a/source/css/_common/scaffolding/base.styl +++ b/source/css/_common/scaffolding/base.styl @@ -13,6 +13,8 @@ body { font-family: $font-family-base; font-size: $font-size-base; line-height: $line-height-base; + min-height: 100%; + position: relative; transition: all $transition-ease; } diff --git a/source/css/_schemes/Muse/_sidebar.styl b/source/css/_schemes/Muse/_sidebar.styl index b660a46..2b3a8e9 100644 --- a/source/css/_schemes/Muse/_sidebar.styl +++ b/source/css/_schemes/Muse/_sidebar.styl @@ -1,7 +1,7 @@ if (hexo-config('sidebar.position') == 'right') { .sidebar-active { +desktop() { - padding-right: $sidebar-desktop; + margin-right: $sidebar-desktop; } } @@ -15,7 +15,7 @@ if (hexo-config('sidebar.position') == 'right') { } else { .sidebar-active { +desktop() { - padding-left: $sidebar-desktop; + margin-left: $sidebar-desktop; } } diff --git a/source/js/utils.js b/source/js/utils.js index 157232b..0f95a0d 100644 --- a/source/js/utils.js +++ b/source/js/utils.js @@ -145,9 +145,7 @@ NexT.utils = { // For init back to top in sidebar if page was scrolled after page refresh. window.addEventListener('scroll', () => { if (backToTop || readingProgressBar) { - const docHeight = document.querySelector('.container').offsetHeight; - const winHeight = window.innerHeight; - const contentHeight = docHeight > winHeight ? docHeight - winHeight : document.body.scrollHeight - winHeight; + const contentHeight = document.body.scrollHeight - window.innerHeight; const scrollPercent = contentHeight > 0 ? Math.min(100 * window.scrollY / contentHeight, 100) : 0; if (backToTop) { backToTop.classList.toggle('back-to-top-on', Math.round(scrollPercent) >= 5);