From 1132779c4057bf96be1b73a3473b1545c3b5ab7a Mon Sep 17 00:00:00 2001 From: binsee Date: Tue, 25 Apr 2017 15:31:04 +0800 Subject: [PATCH] docs(head.swig):fix the document page anchor position offset. (#790) When the document page is opened by an anchor, the top position of the page is offset. Use jquery to fix the problem in the docs template. --- docs/themes/egg/layout/partial/head.swig | 2 +- docs/themes/egg/source/css/page/page.less | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/docs/themes/egg/layout/partial/head.swig b/docs/themes/egg/layout/partial/head.swig index de50a48d57..0cd500044c 100644 --- a/docs/themes/egg/layout/partial/head.swig +++ b/docs/themes/egg/layout/partial/head.swig @@ -5,4 +5,4 @@ -{{ css('css/index') }} +{{ css('css/index') }} \ No newline at end of file diff --git a/docs/themes/egg/source/css/page/page.less b/docs/themes/egg/source/css/page/page.less index 8176cf371f..2ead07bf4d 100644 --- a/docs/themes/egg/source/css/page/page.less +++ b/docs/themes/egg/source/css/page/page.less @@ -31,4 +31,22 @@ .page-main article { min-height: 400px; padding:50px 50px 50px 270px; -} + + h2, h3, h4, h5, h6 { + position: static; + a.markdown-anchor { + position: relative; + height: 25px; + margin-right: -25px; + display: inline-block; + } + + &:before { + content: ''; + display: block; + margin-top: -76px; + height: 76px; + visibility: hidden; + } + } +} \ No newline at end of file