From 53cee5064fabeb2f934aaecb4f6f70f22f520730 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 26 Dec 2018 10:47:54 -0500 Subject: [PATCH] tweak top nav --- site/src/components/TopNav.html | 41 +++++++++++++++++++++----------- site/src/routes/guide/index.html | 12 +++++----- 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/site/src/components/TopNav.html b/site/src/components/TopNav.html index 42b322ce1b..831ca598fd 100644 --- a/site/src/components/TopNav.html +++ b/site/src/components/TopNav.html @@ -6,6 +6,7 @@ export let segment; let open = false; + let visible = true; // TODO remove this post-https://github.com/sveltejs/svelte/issues/1914 let ul; @@ -28,6 +29,14 @@ }); }; }); + + let last_scroll = 0; + function handle_scroll() { + const scroll = window.pageYOffset; + visible = (scroll < 50 || scroll < last_scroll); + + last_scroll = scroll; + } - + -
+