From 71dacc0da2dec41736d9b259f9e51fdb049f3aa6 Mon Sep 17 00:00:00 2001 From: "phattaranun.a" Date: Sat, 12 Sep 2026 16:04:57 +0700 Subject: [PATCH] Eliminate horizontal scrolling on phone: wrap instead of scroll - Topbar: switch from overflow-x:auto to a two-line layout on mobile (brand + language on line 1, nav full-width on line 2) so the header never scrolls left/right - Province filter strip: flex-wrap instead of overflow-x:auto so the province chips wrap onto multiple lines - Reset topbar/nav to single-line at >=640px Site now scrolls vertically only on phone; zero user horizontal scroll. --- ui/responsive.css | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/ui/responsive.css b/ui/responsive.css index f98608e..c526c6a 100644 --- a/ui/responsive.css +++ b/ui/responsive.css @@ -35,18 +35,17 @@ img, svg, video { max-width: 100%; height: auto; } .mu-container { padding: 0 16px; } main.mu-container { padding-top: 24px; padding-bottom: 24px; } -/* --- topbar --- */ -.mu-topbar-inner { gap: 8px; padding: 10px 14px; overflow-x: auto; scrollbar-width: none; } -.mu-topbar-inner::-webkit-scrollbar { display: none; } +/* --- topbar: 2 แถวบนมือถือ (brand+lang บรรทัด1, nav บรรทัด2) — ไม่มี scroll ซ้ายขวา --- */ +.mu-topbar-inner { gap: 8px; padding: 10px 14px; flex-wrap: wrap; } .mu-logo-img { width: 36px; height: 36px; } .mu-brand { gap: 8px; flex-shrink: 0; } .mu-brand-title { font-size: .92rem; white-space: nowrap; } -.mu-brand-subtitle { display: none; } /* กันล้น — โผล่กลับ ≥640px */ -.mu-nav { gap: 8px; margin-left: auto; flex-shrink: 0; } +.mu-brand-subtitle { display: none; } /* กันล้น — โผล่กลับ ≥768px */ +.mu-nav { order: 3; width: 100%; justify-content: space-between; margin-left: 0; gap: 8px; } .mu-nav a { font-size: .76rem; padding: 10px 2px; white-space: nowrap; } /* tap target ≥44px */ -.mu-lang-switch { margin-left: 2px; padding: 2px; } +.mu-lang-switch { margin-left: auto; padding: 2px; } .mu-lang-btn { font-size: .68rem; padding: 8px 12px; min-height: 40px; min-width: 40px; } /* tap target */ -.mu-action-btn { display: none; } /* กันล้นบนจอเล็ก — โผล่กลับ ≥640px */ +.mu-action-btn { display: none; } /* กันล้นบนจอเล็ก — โผล่กลับ ≥1024px */ /* --- hero (หน้าแรก) — ลดช่องว่างแนวตั้ง --- */ .mu-hero { padding: 20px 0 22px; } @@ -87,10 +86,9 @@ main.mu-container { padding-top: 14px; padding-bottom: 14px; } #view .mu-toolbar .mu-btn { width: 100%; min-height: 44px; } #view .mu-search-field { width: 100%; min-width: 0; } #view .mu-province-strip { - display: flex; flex-wrap: nowrap; overflow-x: auto; - -webkit-overflow-scrolling: touch; padding-bottom: 6px; + display: flex; flex-wrap: wrap; padding-bottom: 6px; } -#view .mu-province-strip a { white-space: nowrap; flex-shrink: 0; min-height: 40px; } +#view .mu-province-strip a { white-space: nowrap; min-height: 40px; } #view .mu-stop-grid { grid-template-columns: 1fr; gap: 12px; } #view .mu-hero-map { min-height: 200px; } @@ -127,13 +125,6 @@ main.mu-container { padding-top: 14px; padding-bottom: 14px; } .mu-footer-contact a { min-height: 44px; } /* tap target */ .mu-sponsor-strip { grid-template-columns: repeat(2, 1fr); gap: 8px; } -/* --- จอแคบมาก (≤360px): topbar ห่อแถว ไม่ให้ nav ถูกตัด --- */ -@media (max-width: 360px) { - .mu-topbar-inner { flex-wrap: wrap; } - .mu-nav { order: 3; width: 100%; justify-content: space-between; margin-left: 0; } - .mu-lang-switch { margin-left: auto; } -} - /* ============================================================ ≥480px — มือถือใหญ่ ============================================================ */ @@ -153,9 +144,9 @@ main.mu-container { padding-top: 14px; padding-bottom: 14px; } body { font-size: 16px; } .mu-container { padding: 0 28px; } .mu-brand-title { font-size: 1.05rem; } - .mu-topbar-inner { gap: 18px; padding: 14px 28px; overflow: visible; } + .mu-topbar-inner { gap: 18px; padding: 14px 28px; flex-wrap: nowrap; } .mu-logo-img { width: 44px; height: 44px; } - .mu-nav { gap: 24px; } + .mu-nav { order: 0; width: auto; margin-left: auto; justify-content: flex-start; gap: 24px; } .mu-nav a { font-size: .92rem; } .mu-lang-btn { font-size: .72rem; padding: 6px 10px; } .mu-hero { padding: 44px 0 52px; }