From 57d088bf4c7c67d88d3b0f6b0c613cb05a3aba50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=9E=E9=9B=AA=E6=97=A0=E6=83=85?= Date: Sat, 21 Dec 2019 21:25:07 +0800 Subject: [PATCH] fix toc width --- README.md | 4 ++++ README_EN.md | 4 ++++ layouts/partials/toc.html | 11 +++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0dae92d..d2f54d6 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,10 @@ git clone https://github.com/flysnow-org/maupassant-hugo themes/maupassant ## 配置 +#### 依赖要求 + +Hugo Version >= v 0.60.0 + #### 应用主题 ```toml diff --git a/README_EN.md b/README_EN.md index ac01ace..14debfd 100644 --- a/README_EN.md +++ b/README_EN.md @@ -12,6 +12,10 @@ A simple Hugo template with great performance on different devices, ported from ## Features +#### Requirements + +Hugo Version >= v 0.60.0 + ## Installation ```bash diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html index 106487c..39617b2 100644 --- a/layouts/partials/toc.html +++ b/layouts/partials/toc.html @@ -3,7 +3,7 @@ .post-toc { position: fixed; width: 200px; - margin-left: -220px; + margin-left: -210px; padding: 5px 10px; font-family: Athelas, STHeiti, Microsoft Yahei, serif; font-size: 12px; @@ -25,10 +25,12 @@ } .post-toc .post-toc-title { - margin: 0 10px; + width: 100%; + margin: 0 auto; font-size: 20px; font-weight: 400; text-transform: uppercase; + text-align: center; } .post-toc .post-toc-content { @@ -68,6 +70,11 @@ $(document).ready(function () { var postToc = $(".post-toc"); if (postToc.length) { + var leftPos = $("#main").offset().left; + if(leftPos<220){ + postToc.css({"width":leftPos-10,"margin-left":(0-leftPos)}) + } + var t = postToc.offset().top - 20, a = { start: {