From 43ddcb23d8301fa8fde271ca336537ee3e770cbf Mon Sep 17 00:00:00 2001 From: sadorowo Date: Sat, 16 Mar 2024 11:03:32 +0100 Subject: [PATCH] fix: padding + add: top/bottom buttons --- assets/script.js | 16 +++++++++------- assets/style.css | 14 +++++++++++--- assets/style.dark.css | 9 +++++++-- assets/style.mobile.css | 22 +++++++++++++++++++--- index.html | 11 +++++++---- 5 files changed, 53 insertions(+), 19 deletions(-) diff --git a/assets/script.js b/assets/script.js index 2b17337..147531b 100644 --- a/assets/script.js +++ b/assets/script.js @@ -3,11 +3,14 @@ if (typeof age !== 'undefined') { age.textContent = difference.toFixed(4); } -if (typeof arrow !== 'undefined') { - arrow.addEventListener('click', () => { - window.scrollTo({ - top: document.body.scrollHeight, - behavior: 'smooth' +if (typeof arrow_top !== 'undefined' && typeof arrow_bottom !== 'undefined') { + [arrow_top, arrow_bottom].forEach(arrow => { + arrow.addEventListener('click', () => { + console.warn('scroll!') + window.scrollTo({ + top: arrow === arrow_top ? 0 : document.body.scrollHeight, + behavior: 'smooth' + }); }); }); } @@ -24,10 +27,9 @@ smoothScrollLinks.forEach(link => { }); }); -const switchTheme = document.getElementById('switch-theme'); const theme = localStorage.getItem('theme'); -switchTheme?.addEventListener('click', () => { +switch_theme?.addEventListener('click', () => { if (theme === 'dark') { localStorage.setItem('theme', 'light'); } else { diff --git a/assets/style.css b/assets/style.css index 301bae4..836f8e5 100644 --- a/assets/style.css +++ b/assets/style.css @@ -29,7 +29,7 @@ body#centered { align-content: center; } -body>div { +body>div:not([id]) { display: grid; overflow-y: auto; place-items: center; @@ -37,13 +37,13 @@ body>div { float: left; height: 100%; + border: 1px solid; width: calc(100% / var(--columns)); } body>div:first-child #arrow { bottom: 0; width: 100%; - height: 2em; display: none; cursor: pointer; @@ -88,8 +88,16 @@ ol li::before { content: "✉ "; } -#switch-theme { +#switch_theme { color: blue; cursor: pointer; text-decoration: underline; +} + +body>#arrows { + display: none; +} + +body>#arrows>div { + padding: 0.5em; } \ No newline at end of file diff --git a/assets/style.dark.css b/assets/style.dark.css index c9ae5b6..d91aa58 100644 --- a/assets/style.dark.css +++ b/assets/style.dark.css @@ -18,7 +18,7 @@ body.dark>div:first-child #arrow { background-color: #fff; } -body > div:first-child #arrow { +body>div:first-child #arrow { background-color: var(--color); color: var(--background-color); } @@ -27,6 +27,11 @@ body.dark a { color: var(--color); } -body.dark #switch-theme { +body.dark #switch_theme { color: var(--color); +} + +body.dark>#arrows>div { + background-color: var(--color); + color: var(--background-color); } \ No newline at end of file diff --git a/assets/style.mobile.css b/assets/style.mobile.css index 9326233..5214d25 100644 --- a/assets/style.mobile.css +++ b/assets/style.mobile.css @@ -1,9 +1,25 @@ @media screen and (max-width: 767px) { - body > div { + body>div { width: 100% !important; } - body > div:first-child #arrow { - display: block !important; + body>div>div#inner { + padding: 0.5em !important; + } + + body>#arrows { + display: flex !important; + width: 100% !important; + position: fixed; + bottom: 0; + right: 0; + } + + body>#arrows>div { + width: 50%; + text-align: center; + background-color: black; + color: white; + cursor: pointer; } } \ No newline at end of file diff --git a/index.html b/index.html index 457846c..8541628 100644 --- a/index.html +++ b/index.html @@ -46,9 +46,7 @@

go to top

-

switch theme

- -
+

switch theme

@@ -96,7 +94,7 @@ -

my music taste

+

my music taste

i'm a fan of:

+ +
+
+
+
\ No newline at end of file