From 294d5bd6568c08263a38f928d3c3c5993ae06dae Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 19 Jun 2022 17:10:35 +0100 Subject: [PATCH] Wire up scroll to top button --- static/src/js/base.js | 4 ++++ static/src/scss/base.scss | 1 - website/common/templates/common/hero.html | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/static/src/js/base.js b/static/src/js/base.js index 77a1929..23d5ec5 100644 --- a/static/src/js/base.js +++ b/static/src/js/base.js @@ -6,4 +6,8 @@ window.addEventListener("load", () => { navbarBurger.classList.toggle("is-active"); navbar.classList.toggle("is-active"); }); + + document.getElementById("scroll-top").addEventListener("click", () => { + window.scrollTo({ top: 0, behavior: "smooth" }); + }); }); diff --git a/static/src/scss/base.scss b/static/src/scss/base.scss index 40a7bbe..6cc8389 100644 --- a/static/src/scss/base.scss +++ b/static/src/scss/base.scss @@ -12,7 +12,6 @@ html, body { height: 100%; - overflow-y: auto; display: flex; flex-direction: column; } diff --git a/website/common/templates/common/hero.html b/website/common/templates/common/hero.html index c4af0f1..06a380a 100644 --- a/website/common/templates/common/hero.html +++ b/website/common/templates/common/hero.html @@ -33,7 +33,7 @@ - +