Skip to content

Commit bf4cf2e

Browse files
authored
Merge pull request #45 from lfalin/fix-sticky-header
Fix sticky header jumpiness
2 parents 9edc2e2 + c68dda1 commit bf4cf2e

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

layouts/partials/header.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@
2727
<section id="body">
2828
<div id="overlay"></div>
2929

30-
<div class="padding highlightable">
31-
32-
<div id="top-bar">
30+
<div class="padding highlightable sticky-parent">
31+
32+
<div class="sticky-spacer">
33+
<div id="top-bar">
3334
{{ if and .IsPage .Site.Params.editURL }}
3435
{{ $File := .File }}
3536
{{ $Site := .Site }}
@@ -71,6 +72,7 @@
7172
{{ if .Params.toc }}
7273
{{ partial "toc.html" . }}
7374
{{ end }}
75+
</div>
7476

7577
</div>
7678
{{ if $isChapter }}

static/js/hugo-learn.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ images.each(function(index){
5656
});
5757

5858
// Stick the top to the top of the screen when scrolling
59-
$("#top-bar").stick_in_parent({spacer: false});
59+
$("#top-bar").stick_in_parent( {
60+
parent: ".sticky-parent",
61+
spacer: ".sticky-spacer",
62+
});
6063

6164

6265
jQuery(document).ready(function() {

0 commit comments

Comments
 (0)