Jumping to headlines now accounts for the fixed header's height
authorAlexander Ebert <ebert@woltlab.com>
Wed, 25 Sep 2019 10:31:56 +0000 (12:31 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 25 Sep 2019 10:31:56 +0000 (12:31 +0200)
wcfsetup/install/files/lib/system/html/toc/HtmlToc.class.php
wcfsetup/install/files/style/ui/article.scss

index 7a525e46250900c86880f516af1db9277b828cfb..436b1c19457b3a4c7ddb431c0986d6424ae43d1e 100644 (file)
@@ -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);
index 53ba8d59cb3370c54f2c4f4dc7ea8101cc601baa..c43220087a2d26df948e12f9122f469b2c0fa508 100644 (file)
        .articleLikeButtons:not(:empty) {
                margin-top: 20px;
        }
+       
+       .anchorFixedHeader:target::before {
+               content: "";
+               display: block;
+               height: 50px;
+               margin-top: -50px;
+       }
 }
 
 .articleAboutAuthor {