Mercurial Hosting > lang
changeset 8:2b7dcf355a78
better scrolling
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 18 Jul 2025 23:46:48 -0600 |
parents | 255c36830154 |
children | 46097e607701 |
files | .hgignore src/images/arrow_back.svg src/images/arrow_downward.svg src/images/arrow_upward.svg src/lib/Shared.luan src/site.css src/site.js |
diffstat | 7 files changed, 40 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Fri Jul 18 17:42:45 2025 -0600 +++ b/.hgignore Fri Jul 18 23:46:48 2025 -0600 @@ -4,3 +4,4 @@ local/ private/Config.luan mine/ +.DS_Store
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/images/arrow_back.svg Fri Jul 18 23:46:48 2025 -0600 @@ -0,0 +1,1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 -960 960 960" width="16px" fill="#5f6368"><path d="m313-440 224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"/></svg> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/images/arrow_downward.svg Fri Jul 18 23:46:48 2025 -0600 @@ -0,0 +1,1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 -960 960 960" width="16px" fill="#5f6368"><path d="M440-800v487L216-537l-56 57 320 320 320-320-56-57-224 224v-487h-80Z"/></svg> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/images/arrow_upward.svg Fri Jul 18 23:46:48 2025 -0600 @@ -0,0 +1,1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 -960 960 960" width="16px" fill="#5f6368"><path d="M440-160v-487L216-423l-56-57 320-320 320 320-56 57-224-224v487h-80Z"/></svg> \ No newline at end of file
--- a/src/lib/Shared.luan Fri Jul 18 17:42:45 2025 -0600 +++ b/src/lib/Shared.luan Fri Jul 18 23:46:48 2025 -0600 @@ -32,6 +32,9 @@ <span> <a href="/">Lang</a> </span> + <img onclick="scrollToTop()" src="/images/arrow_upward.svg"> + <img onclick="scrollBack()" src="/images/arrow_back.svg"> + <img onclick="scrollToBottom()" src="/images/arrow_downward.svg"> <span> <% if user == nil then %> <a href="/login.html">Login / Register</a> @@ -40,6 +43,7 @@ <% end %> </span> </div> + <div padding></div> <% end
--- a/src/site.css Fri Jul 18 17:42:45 2025 -0600 +++ b/src/site.css Fri Jul 18 23:46:48 2025 -0600 @@ -28,6 +28,14 @@ padding: 8px 3%; display: flex; justify-content: space-between; + z-index: 1; + position: fixed; + top: 0; + left: 0; + right: 0; +} +div[padding] { + height: 32px; } [content] { @@ -36,6 +44,13 @@ margin-bottom: 2em; } +@media print { + div[header], + div[padding] { + display: none; + } +} + span[pulldown] { position: relative; }
--- a/src/site.js Fri Jul 18 17:42:45 2025 -0600 +++ b/src/site.js Fri Jul 18 23:46:48 2025 -0600 @@ -102,3 +102,20 @@ function closeModal(el) { getEnclosingDialog(el).close(); } + +let lastY = 0; + +function scrollToTop() { + lastY = window.scrollY; + window.scrollTo( 0, 0 ); +} + +function scrollToBottom() { + lastY = window.scrollY; + window.scrollTo( 0, document.body.scrollHeight ); +} + +function scrollBack() { + window.scrollTo( 0, lastY ); +} +