-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDiscoUI_tabs-horizontal-PropelPitchingM4.1.html
More file actions
378 lines (322 loc) · 11.5 KB
/
DiscoUI_tabs-horizontal-PropelPitchingM4.1.html
File metadata and controls
378 lines (322 loc) · 11.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Horizontal Accordion</title>
<!--
╔══════════════════════════════════════════════════════════════╗
║ HORIZONTAL ACCORDION — USAGE INSTRUCTIONS ║
╚══════════════════════════════════════════════════════════════╝
EMBEDDING IN AN IFRAME
───────────────────────
<iframe src="accordion-horizontal.html"
width="100%"
height="360"
frameborder="0"
allowtransparency="true">
</iframe>
Adjust height to suit your content length.
EDITING CONTENT
────────────────
All content is in the CONTENT section at the top of the
<script> block near the bottom of this file:
{ heading: 'Your heading', body: 'Your body text.' },
ADDING OR REMOVING ITEMS
──────────────────────────
Add or remove objects in the items array. The tabs and
panel rebuild automatically — no HTML changes needed.
Note: more than 5 items will become cramped on desktop
and will stack vertically on mobile regardless.
BEHAVIOUR
──────────
Desktop: tabs sit side by side, content opens in a shared
panel below the full row.
Mobile (below 560px): stacks vertically, content opens
directly below the heading that was clicked.
CHANGING THE PAGE TITLE
────────────────────────
Edit the <title> tag above.
-->
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Inter', sans-serif;
background: #fff;
display: flex;
align-items: flex-start;
justify-content: center;
min-height: unset;
padding: 24px;
}
.container {
width: 100%;
max-width: 660px;
}
/* ══ DESKTOP LAYOUT (≥560px) ═══════════════════════════ */
/* Tab strip */
.tab-strip {
display: flex;
border: 1px solid #e5e7eb;
border-radius: 12px 12px 0 0;
overflow: hidden;
background: #f9fafb;
}
.tab-btn {
flex: 1;
padding: 16px 12px;
background: none;
border: none;
border-right: 1px solid #e5e7eb;
cursor: pointer;
font-family: 'Inter', sans-serif;
font-size: 13px;
font-weight: 500;
color: #6b7280;
line-height: 1.3;
text-align: center;
transition: background 0.15s, color 0.15s;
position: relative;
}
.tab-btn:last-child { border-right: none; }
.tab-btn:hover { background: #f3f4f6; color: #374151; }
.tab-btn.active {
background: #ffffff;
color: #2563eb;
font-weight: 600;
}
.tab-btn.active::after {
content: '';
position: absolute;
bottom: 0; left: 0; right: 0;
height: 2.5px;
background: #2563eb;
border-radius: 2px 2px 0 0;
}
/* Shared content panel (desktop) */
.panel-wrap {
border: 1px solid #e5e7eb;
border-top: none;
border-radius: 0 0 12px 12px;
background: #ffffff;
display: grid;
grid-template-rows: 0fr;
transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06);
}
.panel-wrap.open { grid-template-rows: 1fr; }
.panel-inner { overflow: hidden; }
.panel-content {
padding: 24px 28px 28px;
font-size: 14px;
line-height: 1.7;
color: #6b7280;
font-weight: 400;
transition: opacity 0.2s;
}
.panel-content.fade { opacity: 0; }
/* Mobile inline panels — hidden on desktop */
.mobile-panel {
display: none;
}
/* Chevron — hidden on desktop */
.tab-btn .chevron { display: none; }
/* ══ MOBILE LAYOUT (<560px) ════════════════════════════ */
@media (max-width: 560px) {
body { padding: 12px; }
/* Hide desktop shared panel */
.panel-wrap { display: none; }
/* Stack tab strip vertically */
.tab-strip {
flex-direction: column;
border-radius: 0;
border: none;
background: none;
gap: 0;
}
/* Each item is its own bordered row */
.tab-item {
border: 1px solid #e5e7eb;
border-bottom: none;
background: #ffffff;
overflow: hidden;
}
.tab-item:first-child { border-radius: 12px 12px 0 0; }
.tab-item:last-child { border-radius: 0 0 12px 12px; border-bottom: 1px solid #e5e7eb; }
.tab-item.open {
box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06);
position: relative;
z-index: 1;
}
.tab-btn {
width: 100%;
flex: none;
border-right: none;
border-bottom: none;
text-align: left;
padding: 16px 18px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
background: #f9fafb;
}
.tab-btn:hover { background: #f3f4f6; }
.tab-item.open .tab-btn {
background: #f9fafb;
border-bottom: 1px solid #e5e7eb;
color: #2563eb;
font-weight: 600;
}
/* Remove desktop underline indicator */
.tab-btn.active::after { display: none; }
/* Show chevron on mobile */
.tab-btn .chevron {
display: block;
flex-shrink: 0;
color: #d1d5db;
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.tab-item.open .tab-btn .chevron {
transform: rotate(180deg);
color: #2563eb;
}
/* Inline panel per item */
.mobile-panel {
display: grid;
grid-template-rows: 0fr;
transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.tab-item.open .mobile-panel { grid-template-rows: 1fr; }
.mobile-panel-inner { overflow: hidden; }
.mobile-panel-content {
padding: 16px 18px 20px;
font-size: 14px;
line-height: 1.7;
color: #6b7280;
font-weight: 400;
}
}
</style>
</head>
<body>
<div class="container">
<div class="tab-strip" id="tab-strip"></div>
<div class="panel-wrap" id="panel-wrap">
<div class="panel-inner">
<div class="panel-content" id="panel-content"></div>
</div>
</div>
</div>
<script>
// ─── CONTENT ────────────────────────────────────────────────
const items = [
{
heading: 'Investors',
body: 'Investors are evaluating risk and return. They want to understand the size of the opportunity, the strength of your business model, and whether your team can execute. Spend more time on your market opportunity, your traction, and your financial projections. Be ready to defend your assumptions and speak confidently about what you do not know yet as well as what you do.'
},
{
heading: 'Customers',
body: 'Customers are evaluating whether you can solve their problem. They do not need your market size or your funding story. Lead strongly with the problem, make sure they recognise their own experience in your description, and focus the solution section on outcomes rather than features. Move quickly to a clear next step.'
},
{
heading: 'Partners',
body: 'Partners are evaluating whether working together makes sense for both sides. Lead with shared goals rather than your own business metrics. Explain clearly what the partnership would look like in practice, what you bring to it, and what you are looking for from them. Be specific about the kind of partnership you have in mind.'
},
{
heading: 'Media',
body: 'Journalists and media contacts are looking for a story. Lead with the problem and the people it affects. Have a single, memorable headline in mind: the one sentence you want them to take away.'
}
];
// ─────────────────────────────────────────────────────────────
let openIndex = null;
const strip = document.getElementById('tab-strip');
const wrap = document.getElementById('panel-wrap');
const content = document.getElementById('panel-content');
function isMobile() { return window.innerWidth < 560; }
function toggle(index) {
if (isMobile()) {
toggleMobile(index);
} else {
toggleDesktop(index);
}
}
function toggleDesktop(index) {
// Clicking the active tab closes it
if (openIndex === index) {
getItem(index).classList.remove('active');
wrap.classList.remove('open');
openIndex = null;
return;
}
// Switch tabs
if (openIndex !== null) {
getItem(openIndex).classList.remove('active');
content.classList.add('fade');
}
const delay = openIndex !== null ? 150 : 0;
setTimeout(() => {
content.textContent = items[index].body;
content.classList.remove('fade');
getItem(index).classList.add('active');
wrap.classList.add('open');
openIndex = index;
}, delay);
}
function toggleMobile(index) {
const item = document.getElementById('tab-item-' + index);
// Clicking the open item closes it
if (openIndex === index) {
item.classList.remove('open');
getItem(index).classList.remove('active');
openIndex = null;
return;
}
// Close previously open item
if (openIndex !== null) {
document.getElementById('tab-item-' + openIndex).classList.remove('open');
getItem(openIndex).classList.remove('active');
}
item.classList.add('open');
getItem(index).classList.add('active');
openIndex = index;
}
function getItem(index) {
return document.getElementById('tab-' + index);
}
// Build tabs — each wrapped in a .tab-item div for mobile
items.forEach((item, i) => {
const tabItem = document.createElement('div');
tabItem.className = 'tab-item';
tabItem.id = 'tab-item-' + i;
const btn = document.createElement('button');
btn.className = 'tab-btn';
btn.id = 'tab-' + i;
btn.setAttribute('aria-expanded', 'false');
btn.innerHTML = `${item.heading}<svg class="chevron" width="12" height="12" viewBox="0 0 12 12" fill="none"><path d="M2 4L6 8L10 4" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
btn.onclick = () => toggle(i);
const mobilePanel = document.createElement('div');
mobilePanel.className = 'mobile-panel';
mobilePanel.innerHTML = `<div class="mobile-panel-inner"><div class="mobile-panel-content">${item.body}</div></div>`;
tabItem.appendChild(btn);
tabItem.appendChild(mobilePanel);
strip.appendChild(tabItem);
});
// Reset open state on resize so layout switches cleanly
window.addEventListener('resize', () => {
if (openIndex !== null) {
// Reclose everything and reopen in the correct mode
const idx = openIndex;
openIndex = null;
wrap.classList.remove('open');
document.querySelectorAll('.tab-item').forEach(el => el.classList.remove('open'));
document.querySelectorAll('.tab-btn').forEach(el => el.classList.remove('active'));
toggle(idx);
}
});
// Open first tab by default
toggle(0);
</script>
</body>
</html>