From d839503c1e369f2b53e4054b574e469e36992ca6 Mon Sep 17 00:00:00 2001 From: phantamanta44 Date: Mon, 19 Jul 2021 15:13:15 -0500 Subject: [PATCH] Add scroll-to-top button for mobile advanced atlas --- items_2.css | 23 +++++++++++++++++++++++ items_2.html | 1 + items_2.js | 4 ++++ 3 files changed, 28 insertions(+) diff --git a/items_2.css b/items_2.css index 9bdfc91..f23e295 100644 --- a/items_2.css +++ b/items_2.css @@ -114,3 +114,26 @@ margin: 0 0 14px; } } + +#scroll-up { + width: 10vw; + height: 10vw; + bottom: 4vw; + right: 4vw; + position: fixed; + display: none; + background-color: #212121; + font-size: 12pt; + font-weight: bold; + text-align: center; + line-height: 10vw; + border: 1px solid #666; + cursor: pointer; + user-select: none; +} + +@media(max-width: 1099px) { + #scroll-up { + display: block; + } +} diff --git a/items_2.html b/items_2.html index f0650c1..24a4c38 100644 --- a/items_2.html +++ b/items_2.html @@ -58,6 +58,7 @@ + diff --git a/items_2.js b/items_2.js index 656a731..1f846ed 100644 --- a/items_2.js +++ b/items_2.js @@ -404,6 +404,10 @@ function init_items2() { // focus the query filter text box searchFilterField.field.focus(); searchFilterField.field.select(); + + // scroll-to-top button + document.getElementById('scroll-up') + .addEventListener('mousedown', e => scrollTo({ top: 0, behavior: 'smooth' })); } load_init(init_items2);