From: Alexander Ebert Date: Wed, 25 Sep 2019 10:31:56 +0000 (+0200) Subject: Jumping to headlines now accounts for the fixed header's height X-Git-Tag: 5.2.0_Beta_2~42 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f0fb0f30de5607e34e81fbe08e7f9e4905870965;p=GitHub%2FWoltLab%2FWCF.git Jumping to headlines now accounts for the fixed header's height --- diff --git a/wcfsetup/install/files/lib/system/html/toc/HtmlToc.class.php b/wcfsetup/install/files/lib/system/html/toc/HtmlToc.class.php index 7a525e4625..436b1c1945 100644 --- a/wcfsetup/install/files/lib/system/html/toc/HtmlToc.class.php +++ b/wcfsetup/install/files/lib/system/html/toc/HtmlToc.class.php @@ -52,6 +52,10 @@ class HtmlToc { // the need of user interactions, making it a somewhat cumbersome experience. KISS. $id = "{$idPrefix}-{$id}"; + $classes = $hElement->getAttribute('class'); + if (!empty($classes)) $classes .= ' '; + $hElement->setAttribute('class', $classes . 'anchorFixedHeader'); + $hElement->setAttribute('id', $id); $headings[] = new HtmlTocItem(intval(substr($hElement->tagName, 1, 1)), $id, $title); diff --git a/wcfsetup/install/files/style/ui/article.scss b/wcfsetup/install/files/style/ui/article.scss index 53ba8d59cb..c43220087a 100644 --- a/wcfsetup/install/files/style/ui/article.scss +++ b/wcfsetup/install/files/style/ui/article.scss @@ -60,6 +60,13 @@ .articleLikeButtons:not(:empty) { margin-top: 20px; } + + .anchorFixedHeader:target::before { + content: ""; + display: block; + height: 50px; + margin-top: -50px; + } } .articleAboutAuthor {