浏览代码

fix: navbar active link highlighting and scrolling

Fixes edge case caused due to responsive navbar height. More
specifically, a possible race condition between Scrollspy init and
updating its offset.

Fix #1199
George Cushen 6 年之前
父节点
当前提交
64cceae099
共有 1 个文件被更改,包括 1 次插入2 次删除
  1. 1 2
      layouts/_default/baseof.html

+ 1 - 2
layouts/_default/baseof.html

@@ -2,8 +2,7 @@
 <html lang="{{ site.LanguageCode | default "en-us" }}">
 
 {{ partial "site_head.html" . }}
-
-<body id="top" data-spy="scroll" data-target="{{ if or .IsHome (eq .Type "widget_page") }}#navbar-main{{else}}#TableOfContents{{end}}" {{ if not (.Scratch.Get "light") }}class="dark"{{end}}>
+<body id="top" data-spy="scroll" data-offset="70" data-target="{{ if or .IsHome (eq .Type "widget_page") }}#navbar-main{{else}}#TableOfContents{{end}}" {{ if not (.Scratch.Get "light") }}class="dark"{{end}}>
 
   {{ partial "search" . }}