diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-10-22 13:21:41 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-10-27 01:42:01 +0200 |
commit | fc1ce090e9c0277ac6dbedb01cc537ae30af19ec (patch) | |
tree | 9d12fe02dcbe33958958bf7a6bdb88022e640048 | |
parent | a0f9aa5ea53a71e8ba5e5aa131346d855320795a (diff) | |
download | server-fc1ce090e9c0277ac6dbedb01cc537ae30af19ec.tar.gz |
Scroll into view with margins for battle boxes.
-rw-r--r-- | public/common/client.js | 10 | ||||
-rw-r--r-- | public/common/columbia.css | 12 |
2 files changed, 17 insertions, 5 deletions
diff --git a/public/common/client.js b/public/common/client.js index 2b34487..8e6c27d 100644 --- a/public/common/client.js +++ b/public/common/client.js @@ -42,9 +42,13 @@ function scroll_into_view(e) { e.scrollIntoView({ block: "center", inline: "center", behavior: "smooth" }) } -function scroll_into_view_if_mobile(e) { - if (window.innerWidth <= 800) - scroll_into_view(e) +function scroll_into_view_if_needed(e) { + if (window.innerWidth <= 800) { + // TODO: close log on mobile? + e.scrollIntoView({ block: "start", inline: "center", behavior: "smooth" }) + } else { + e.scrollIntoView({ block: "nearest", inline: "nearest", behavior: "smooth" }) + } } function scroll_with_middle_mouse(panel_sel, multiplier) { diff --git a/public/common/columbia.css b/public/common/columbia.css index 2c20d45..209918d 100644 --- a/public/common/columbia.css +++ b/public/common/columbia.css @@ -1,13 +1,21 @@ /* BATTLE DIALOG FOR COLUMBIA BLOCK GAMES */ #battle { + display: none; position: absolute; - min-width: 524px; /* 6 blocks wide */ + scroll-margin: 20px; z-index: 50; box-shadow: 0px 5px 10px 0px rgba(0,0,0,0.5); background-color: white; border: 1px solid black; - display: none; + min-width: 524px; /* 6 blocks wide */ +} + +@media (max-width: 400px) { + #battle { + min-width: 100vw; + min-width: 100dvw; + } } #battle .block { |