Dorjzodovsuren commited on
Commit
64908c9
·
verified ·
1 Parent(s): f0eab5e

dynamic splitting

Browse files
Files changed (1) hide show
  1. index.html +121 -90
index.html CHANGED
@@ -35,27 +35,58 @@
35
  letter-spacing: 1px;
36
  }
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  main {
39
  flex: 1;
40
  display: flex;
41
- flex-direction: column;
42
- align-items: center;
43
- padding: 2rem 1rem;
44
- gap: 2rem;
 
 
45
  width: 100%;
46
- max-width: 900px;
47
- margin: 0 auto;
 
48
  }
49
 
50
- /* Sketchfab embed section (full width) */
51
  .viewer-container {
52
- width: 100%;
53
  background-color: #fff;
54
  border-radius: 12px;
55
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
56
  overflow: hidden;
57
  display: flex;
58
  flex-direction: column;
 
 
 
 
 
 
 
 
59
  }
60
 
61
  .viewer-header {
@@ -88,7 +119,7 @@
88
  text-align: right;
89
  font-size: 0.8rem;
90
  color: #777;
91
- padding: 0.5rem 1rem 1rem;
92
  }
93
 
94
  .credits a {
@@ -96,52 +127,34 @@
96
  text-decoration: none;
97
  }
98
 
99
- /* Plan section with collapsible image (below) */
100
  .plan-container {
101
- width: 100%;
102
  background-color: #fff;
103
  border-radius: 12px;
104
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
105
  overflow: hidden;
106
- display: flex;
107
  flex-direction: column;
 
 
 
108
  }
109
 
110
- .plan-header {
111
- background-color: #283e51;
112
- color: #fff;
113
- padding: 1rem;
114
- display: flex;
115
- align-items: center;
116
- justify-content: space-between;
117
- font-size: 1.25rem;
118
- letter-spacing: 0.5px;
119
- cursor: pointer;
120
- user-select: none;
121
- }
122
-
123
- /* Arrow icon style */
124
- .arrow-toggle {
125
- font-size: 1.25rem;
126
- transition: transform 0.2s ease-in-out;
127
- }
128
-
129
  .plan-image-wrapper {
130
- overflow: hidden;
131
- max-height: 0;
132
- transition: max-height 0.3s ease;
133
- }
134
-
135
- /* When expanded, allow full height */
136
- .plan-image-wrapper.expanded {
137
- max-height: 1000px; /* Adjust if needed */
138
  }
139
 
140
  .plan-image-wrapper img {
141
- display: block;
 
 
142
  width: 100%;
143
- height: auto;
144
- border-top: 1px solid #ddd;
145
  }
146
 
147
  footer {
@@ -152,14 +165,29 @@
152
  font-size: 0.9rem;
153
  }
154
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  @media (max-width: 600px) {
156
  header h1 {
157
  font-size: 1.5rem;
158
  }
159
- .viewer-header,
160
- .plan-header {
161
  font-size: 1rem;
162
  }
 
 
 
 
163
  }
164
  </style>
165
  </head>
@@ -168,35 +196,38 @@
168
  <h1>Visualizer of Design Model of Nomadic Echo Interior</h1>
169
  </header>
170
 
 
 
 
 
 
171
  <main>
172
- <!-- Sketchfab Viewer Section -->
173
- <div class="viewer-container">
174
- <div class="viewer-header">Explore the 3D Model</div>
175
- <div class="sketchfab-embed-wrapper">
176
- <iframe
177
- title="25d4c696-c992-43d5-ab5a-03212692591a"
178
- src="https://sketchfab.com/models/3d0aefaafa9c4143a9e67e67895dc4da/embed?autostart=1&camera=0&preload=1"
179
- allow="autoplay; fullscreen; xr-spatial-tracking"
180
- xr-spatial-tracking
181
- execution-while-out-of-viewport
182
- execution-while-not-rendered
183
- web-share
184
- ></iframe>
 
 
 
 
 
 
185
  </div>
186
- <div class="credits">
187
- Model by <a href="https://sketchfab.com/Ibdzs" target="_blank" rel="noopener">Dorjzodovsuren Batjargal</a>
188
- on <a href="https://sketchfab.com" target="_blank" rel="noopener">Sketchfab</a>
189
- </div>
190
- </div>
191
 
192
- <!-- Plan Image Section (collapsible, below) -->
193
- <div class="plan-container">
194
- <div class="plan-header" id="planToggle">
195
- <span>Floor Plan</span>
196
- <span class="arrow-toggle" id="arrowIcon">►</span>
197
- </div>
198
- <div class="plan-image-wrapper" id="planWrapper">
199
- <img src="plan_image.jpg" alt="Floor Plan of Nomadic Echo Interior" />
200
  </div>
201
  </div>
202
  </main>
@@ -206,27 +237,27 @@
206
  </footer>
207
 
208
  <script>
209
- // Grab elements
210
- const planToggle = document.getElementById('planToggle');
211
- const planWrapper = document.getElementById('planWrapper');
212
- const arrowIcon = document.getElementById('arrowIcon');
213
-
214
- // Start collapsed
215
- let isExpanded = false;
216
-
217
- planToggle.addEventListener('click', () => {
218
- isExpanded = !isExpanded;
219
-
220
- if (isExpanded) {
221
- // Expand: add class
222
- planWrapper.classList.add('expanded');
223
- // Change arrow icon
224
- arrowIcon.textContent = '▼';
225
  } else {
226
- // Collapse: remove class
227
- planWrapper.classList.remove('expanded');
228
- // Reset arrow icon
229
- arrowIcon.textContent = '';
 
230
  }
231
  });
232
  </script>
 
35
  letter-spacing: 1px;
36
  }
37
 
38
+ /* Container for the toggle button */
39
+ .button-wrapper {
40
+ text-align: center;
41
+ margin: 1.5rem 0;
42
+ }
43
+
44
+ .hint-button {
45
+ padding: 0.75rem 1.5rem;
46
+ background-color: #4b79a1;
47
+ color: #fff;
48
+ border: none;
49
+ border-radius: 8px;
50
+ font-size: 1rem;
51
+ cursor: pointer;
52
+ transition: background-color 0.2s ease;
53
+ }
54
+
55
+ .hint-button:hover {
56
+ background-color: #3a5f7a;
57
+ }
58
+
59
  main {
60
  flex: 1;
61
  display: flex;
62
+ justify-content: center;
63
+ padding: 0 1rem 2rem;
64
+ }
65
+
66
+ .content-wrapper {
67
+ display: flex;
68
  width: 100%;
69
+ max-width: 1200px;
70
+ gap: 1.5rem;
71
+ justify-content: center;
72
  }
73
 
74
+ /* Viewer container */
75
  .viewer-container {
 
76
  background-color: #fff;
77
  border-radius: 12px;
78
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
79
  overflow: hidden;
80
  display: flex;
81
  flex-direction: column;
82
+ /* Start at 70% width */
83
+ flex: 0 0 70%;
84
+ transition: flex 0.3s ease;
85
+ }
86
+
87
+ /* Class to shrink viewer to 50% */
88
+ .half-width {
89
+ flex: 0 0 50% !important;
90
  }
91
 
92
  .viewer-header {
 
119
  text-align: right;
120
  font-size: 0.8rem;
121
  color: #777;
122
+ padding: 0.5rem 1rem;
123
  }
124
 
125
  .credits a {
 
127
  text-decoration: none;
128
  }
129
 
130
+ /* Plan container (hidden initially) */
131
  .plan-container {
 
132
  background-color: #fff;
133
  border-radius: 12px;
134
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
135
  overflow: hidden;
136
+ display: none; /* hidden by default */
137
  flex-direction: column;
138
+ /* Will become half-width when shown */
139
+ flex: 0 0 50%;
140
+ transition: flex 0.3s ease;
141
  }
142
 
143
+ /* Plan image wrapper to maintain 16:9 aspect ratio */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  .plan-image-wrapper {
145
+ position: relative;
146
+ width: 100%;
147
+ padding-top: 56.25%;
148
+ background-color: #000;
 
 
 
 
149
  }
150
 
151
  .plan-image-wrapper img {
152
+ position: absolute;
153
+ top: 0;
154
+ left: 0;
155
  width: 100%;
156
+ height: 100%;
157
+ object-fit: contain;
158
  }
159
 
160
  footer {
 
165
  font-size: 0.9rem;
166
  }
167
 
168
+ @media (max-width: 900px) {
169
+ .content-wrapper {
170
+ flex-direction: column;
171
+ align-items: center;
172
+ }
173
+ .viewer-container,
174
+ .plan-container {
175
+ flex: 0 0 100% !important;
176
+ max-width: 100%;
177
+ }
178
+ }
179
+
180
  @media (max-width: 600px) {
181
  header h1 {
182
  font-size: 1.5rem;
183
  }
184
+ .viewer-header {
 
185
  font-size: 1rem;
186
  }
187
+ .hint-button {
188
+ width: 80%;
189
+ font-size: 0.9rem;
190
+ }
191
  }
192
  </style>
193
  </head>
 
196
  <h1>Visualizer of Design Model of Nomadic Echo Interior</h1>
197
  </header>
198
 
199
+ <!-- Button placed outside the render card -->
200
+ <div class="button-wrapper">
201
+ <button class="hint-button" id="hintBtn">Show Floor Plan</button>
202
+ </div>
203
+
204
  <main>
205
+ <div class="content-wrapper">
206
+ <!-- Viewer Panel (initially 70% width) -->
207
+ <div class="viewer-container" id="viewerPanel">
208
+ <div class="viewer-header">Explore the 3D Model</div>
209
+ <div class="sketchfab-embed-wrapper">
210
+ <iframe
211
+ title="25d4c696-c992-43d5-ab5a-03212692591a"
212
+ src="https://sketchfab.com/models/3d0aefaafa9c4143a9e67e67895dc4da/embed?autostart=1&camera=0&preload=1"
213
+ allow="autoplay; fullscreen; xr-spatial-tracking"
214
+ xr-spatial-tracking
215
+ execution-while-out-of-viewport
216
+ execution-while-not-rendered
217
+ web-share
218
+ ></iframe>
219
+ </div>
220
+ <div class="credits">
221
+ Model by <a href="https://sketchfab.com/Ibdzs" target="_blank" rel="noopener">Dorjzodovsuren Batjargal</a>
222
+ on <a href="https://sketchfab.com" target="_blank" rel="noopener">Sketchfab</a>
223
+ </div>
224
  </div>
 
 
 
 
 
225
 
226
+ <!-- Plan Panel (hidden initially, will appear at 50% width) -->
227
+ <div class="plan-container" id="planPanel">
228
+ <div class="plan-image-wrapper">
229
+ <img src="plan_image.jpg" alt="Floor Plan of Nomadic Echo Interior" />
230
+ </div>
 
 
 
231
  </div>
232
  </div>
233
  </main>
 
237
  </footer>
238
 
239
  <script>
240
+ const hintBtn = document.getElementById('hintBtn');
241
+ const viewerPanel = document.getElementById('viewerPanel');
242
+ const planPanel = document.getElementById('planPanel');
243
+
244
+ let planVisible = false;
245
+
246
+ hintBtn.addEventListener('click', () => {
247
+ planVisible = !planVisible;
248
+
249
+ if (planVisible) {
250
+ // Show plan panel at 50%, shrink viewer to 50%
251
+ planPanel.style.display = 'flex';
252
+ viewerPanel.classList.add('half-width');
253
+ planPanel.classList.add('half-width');
254
+ hintBtn.textContent = 'Hide Floor Plan';
 
255
  } else {
256
+ // Hide plan panel, set viewer back to 70%
257
+ planPanel.style.display = 'none';
258
+ viewerPanel.classList.remove('half-width');
259
+ planPanel.classList.remove('half-width');
260
+ hintBtn.textContent = 'Show Floor Plan';
261
  }
262
  });
263
  </script>