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.
This commit is contained in:
1 parent
0ac33f0735
commit
71dacc0da2
1 file changed
+10
-19
+10
-19
@@ -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; }
|
||||
|
||||
Reference in new issue
Block a user