From c8a2af1f1a0c671634685edef064d305ad57132b Mon Sep 17 00:00:00 2001 From: tangsongdayo Date: Fri, 20 Nov 2026 16:13:26 +0800 Subject: [PATCH] Editor: pin the play area to the top in the single-column layout Co-Authored-By: Claude Opus 5.5 --- index.html | 58 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/index.html b/index.html index 449b45e..b2f57cc 100644 --- a/index.html +++ b/index.html @@ -32,7 +32,7 @@ header { padding: 20px 16px 4px; max-width: 1200px; margin: 0 auto; } h1 { margin: 0; font-size: 1.6rem; } header p { margin: 4px 0 0; color: var(--muted); } - .layout { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 20px; max-width: 1200px; margin: 0 auto; padding: 16px; align-items: start; } + .layout { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 0 20px; max-width: 1200px; margin: 0 auto; padding: 16px; align-items: start; } .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px 16px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; } .panel > summary { list-style: none; cursor: pointer; font-weight: 700; padding: 12px 0 8px; display: flex; justify-content: space-between; align-items: center; } .panel > summary::-webkit-details-marker { display: none; } @@ -57,6 +57,9 @@ .note { font-size: .85rem; color: var(--muted); margin: 6px 0; } .warn { font-size: .85rem; color: var(--accent); margin: 6px 0; } main { min-width: 0; } + .play-card { grid-column: 2; grid-row: 1; min-width: 0; } + .panel { grid-column: 1; grid-row: 1 / span 2; } + main { grid-column: 2; grid-row: 2; } .card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 20px; } .card h2 { margin: 0 0 8px; font-size: 1.15rem; } .play { min-height: 320px; position: relative; touch-action: pan-y; display: grid; place-items: center; text-align: center; border: 2px dashed var(--line); border-radius: 12px; color: var(--muted); padding: 20px; } @@ -71,9 +74,22 @@ code { background: var(--code); padding: 1px 5px; border-radius: 4px; font-size: .9em; } footer { max-width: 1200px; margin: 0 auto; padding: 0 16px 40px; color: var(--muted); font-size: .85rem; } @media (max-width: 760px) { - .layout { grid-template-columns: minmax(0, 1fr); padding: 12px 16px; } - .panel { position: static; max-height: none; } - .play { min-height: 380px; } + /* 聚焦設定欄位時不要被吸附的試玩區蓋住(只套在面板與輸出區,試玩區本身不受影響) */ + .panel :is(input, select, summary, button), main :is(input, textarea, button, a) { scroll-margin-top: calc(min(36vh, 300px) + 72px); scroll-margin-top: calc(min(36svh, 300px) + 72px); } + .layout { grid-template-columns: minmax(0, 1fr); padding: 0 16px 12px; } + .play-card, .panel, main { grid-column: 1; grid-row: auto; } + .panel { position: static; max-height: none; margin-bottom: 20px; } + /* 單欄時試玩區吸附在畫面上方,往下調設定時一直看得到 */ + .play-card { position: sticky; top: 0; z-index: 20; margin: 0 -16px 16px; padding: 8px 16px 6px; border: 0; border-radius: 0; border-bottom: 1px solid var(--line); box-shadow: 0 6px 14px -8px rgba(0,0,0,.35); } + .play-card h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } + .play { min-height: 0; height: min(36vh, 300px); height: min(36svh, 300px); padding: 8px; font-size: .8rem; line-height: 1.5; } + .play strong { font-size: .9rem; } + .play .more { display: none; } + .bgswitch { margin-top: 10px; gap: 10px; font-size: .8rem; } + .bgswitch input { margin: 0 2px 0 0; vertical-align: -2px; } + } + @media (max-width: 760px) and (max-height: 560px) { + .play { height: 200px; } } @@ -84,6 +100,23 @@
+
+

試玩區

+
+
+ 移動滑鼠,或用手指在畫面上滑動 + 時鐘會跟著你。電腦在游標右下方,手機在手指上方。
+ 這裡的時鐘只在框內預覽;放到你的網站上會跟著整個頁面移動。 +
+
+
+ 預覽底色: + + + +
+
+
設定 點這裡收合 @@ -140,23 +173,6 @@
-
-

試玩區

-
-
- 移動滑鼠,或用手指在畫面上滑動 - 時鐘會跟著你。電腦在游標右下方,手機在手指上方。
- 這裡的時鐘只在框內預覽;放到你的網站上會跟著整個頁面移動。 -
-
-
- 預覽底色: - - - -
-
-

取得程式碼