ginipick commited on
Commit
bbeb028
ยท
verified ยท
1 Parent(s): e56d916

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +101 -155
index.html CHANGED
@@ -140,45 +140,39 @@
140
  height: 100%;
141
  object-fit: contain;
142
  }
143
-
144
-
145
- .thumbnail {
146
- position: relative;
147
- padding-top: 56.25%;
148
- cursor: pointer;
149
- overflow: hidden;
150
- background-color: #000;
151
- border: 3px solid #333;
152
- border-radius: 8px;
153
- box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
154
- transition: transform 0.3s ease;
155
- }
156
-
157
- .thumbnail video {
158
- position: absolute;
159
- top: 0;
160
- left: 0;
161
- width: 100%;
162
- height: 100%;
163
- object-fit: cover;
164
- }
165
-
166
- .gallery {
167
- display: grid;
168
- grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
169
- gap: 15px;
170
- padding: 20px;
171
- background: linear-gradient(45deg, #1a1a1a, #2c2c2c);
172
- border-radius: 15px;
173
- }
174
-
175
  .thumbnail:hover {
176
  transform: translateY(-5px) scale(1.02);
177
  box-shadow:
178
  0 8px 20px rgba(0, 0, 0, 0.8),
179
  0 0 0 1px rgba(255, 255, 255, 0.2);
180
  }
181
-
182
  .thumbnail:hover video {
183
  transform: scale(1.1);
184
  }
@@ -218,7 +212,7 @@
218
  </div>
219
 
220
  <script>
221
-
222
  // ๋น„๋””์˜ค ํŒŒ์ผ ๋ฐฐ์—ด์„ ์ˆ˜์ •ํ•˜์—ฌ ์ˆœ์ฐจ์ ์œผ๋กœ ํƒญ ๋ฒˆํ˜ธ ํ• ๋‹น
223
  const videoFiles = [
224
  // ์ฒซ ๋ฒˆ์งธ ๊ทธ๋ฃน (ํƒญ 1)
@@ -370,141 +364,93 @@ const videoFiles = [
370
 
371
  { file: 'tmps_zu8c60.output.mp4', tab: 8 }
372
  ];
373
-
374
 
375
- function initializeGallery() {
376
- const gallery = document.getElementById('video-gallery');
377
- const selectedThumb = document.getElementById('selected-thumb');
378
- const selectedVideo = document.getElementById('selected-video');
379
- const initialLoadCount = 16;
380
- let loadedVideos = 0;
381
- videoFiles.forEach((videoData, index) => {
382
- const thumbnail = document.createElement('div');
383
- thumbnail.className = 'thumbnail';
384
- thumbnail.dataset.tab = videoData.tab;
385
-
386
- if (index < initialLoadCount) {
387
- createVideoElement(thumbnail, videoData, true);
388
- loadedVideos++;
389
- } else {
390
- thumbnail.dataset.videoSrc = videoData.file;
391
- thumbnail.style.backgroundColor = '#1a1a1a';
392
- }
393
- gallery.appendChild(thumbnail);
394
- });
395
- const observer = new IntersectionObserver((entries) => {
396
- entries.forEach(entry => {
397
- if (entry.isIntersecting) {
398
- const thumbnail = entry.target;
399
- if (thumbnail.dataset.videoSrc) {
400
- createVideoElement(thumbnail, { file: thumbnail.dataset.videoSrc }, false);
401
- delete thumbnail.dataset.videoSrc;
402
- }
403
- }
404
- });
405
- }, {
406
- root: null,
407
- rootMargin: '50px',
408
- threshold: 0.1
409
- });
410
- document.querySelectorAll('.thumbnail').forEach(thumb => {
411
- observer.observe(thumb);
412
  });
413
- if (videoFiles.length > 0) {
414
- selectedThumb.src = videoFiles[0].file;
415
- selectedVideo.src = videoFiles[0].file;
416
- selectedThumb.currentTime = 0;
417
- }
418
- }
419
- function createVideoElement(thumbnail, videoData, autoload) {
420
- const thumbVideo = document.createElement('video');
421
- thumbVideo.src = videoData.file; // ์ง์ ‘ src ์„ค์ •
422
- thumbVideo.playsinline = true;
423
- thumbVideo.muted = true;
424
- thumbVideo.loop = true; // ๋ฐ˜๋ณต ์žฌ์ƒ ์ถ”๊ฐ€
425
- thumbVideo.preload = 'metadata';
426
-
427
- // ๋น„๋””์˜ค ๋กœ๋“œ ์™„๋ฃŒ ํ›„ ์ฒ˜๋ฆฌ
428
- thumbVideo.addEventListener('loadeddata', () => {
429
- thumbVideo.currentTime = 0;
430
- });
431
 
432
- // ์—๋Ÿฌ ์ฒ˜๋ฆฌ ์ถ”๊ฐ€
433
- thumbVideo.addEventListener('error', (e) => {
434
- console.error('Video loading error:', e);
435
- thumbnail.style.backgroundColor = '#333';
436
- });
437
 
438
- thumbnail.addEventListener('mouseenter', () => {
439
- thumbVideo.play().catch(e => console.log('Playback failed:', e));
440
- });
441
 
442
- thumbnail.addEventListener('mouseleave', () => {
443
- thumbVideo.pause();
444
- thumbVideo.currentTime = 0;
445
- });
446
 
447
- thumbnail.addEventListener('click', () => {
448
- const selectedThumb = document.getElementById('selected-thumb');
449
- const selectedVideo = document.getElementById('selected-video');
450
-
451
- selectedThumb.src = videoData.file;
452
- selectedVideo.src = videoData.file;
453
- selectedVideo.play().catch(e => console.log('Playback failed:', e));
454
- });
455
 
456
- thumbnail.appendChild(thumbVideo);
457
- }
458
 
459
- function initializeGallery() {
460
- const gallery = document.getElementById('video-gallery');
461
- const selectedThumb = document.getElementById('selected-thumb');
462
- const selectedVideo = document.getElementById('selected-video');
463
 
464
- // ์ดˆ๊ธฐ ๋น„๋””์˜ค ์„ค์ •
465
- if (videoFiles.length > 0) {
466
- selectedThumb.src = videoFiles[0].file;
467
- selectedVideo.src = videoFiles[0].file;
468
- }
469
 
470
- // ๋ชจ๋“  ๋น„๋””์˜ค ์ธ๋„ค์ผ ์ƒ์„ฑ
471
- videoFiles.forEach((videoData) => {
472
- const thumbnail = document.createElement('div');
473
- thumbnail.className = 'thumbnail';
474
- thumbnail.dataset.tab = videoData.tab;
475
-
476
- createVideoElement(thumbnail, videoData, true);
477
- gallery.appendChild(thumbnail);
478
- });
479
 
480
- // ์ฒซ ๋ฒˆ์งธ ํƒญ ์ปจํ…์ธ  ํ‘œ์‹œ
481
- showTabContent('1');
482
- }
483
 
484
- // ํƒญ ์ปจํ…์ธ  ํ‘œ์‹œ ํ•จ์ˆ˜
485
- function showTabContent(tabNumber) {
486
- const thumbnails = document.querySelectorAll('.thumbnail');
487
- thumbnails.forEach(thumb => {
488
- if (thumb.dataset.tab === tabNumber) {
489
- thumb.style.display = 'block';
490
- } else {
491
- thumb.style.display = 'none';
 
492
  }
493
- });
494
- }
495
 
496
- // ํƒญ ๋ฒ„ํŠผ ์ด๋ฒคํŠธ ๋ฆฌ์Šค๋„ˆ
497
- document.querySelectorAll('.tab-button').forEach(button => {
498
- button.addEventListener('click', () => {
499
- document.querySelectorAll('.tab-button').forEach(btn =>
500
- btn.classList.remove('active'));
501
- button.classList.add('active');
502
- showTabContent(button.dataset.tab);
503
- });
504
- });
505
 
506
- // ๊ฐค๋Ÿฌ๏ฟฝ๏ฟฝ ์ดˆ๊ธฐํ™”
507
- initializeGallery();
 
508
  </script>
509
  </body>
510
- </html>
 
 
 
 
140
  height: 100%;
141
  object-fit: contain;
142
  }
143
+ .thumbnail {
144
+ position: relative;
145
+ padding-top: 56.25%;
146
+ cursor: pointer;
147
+ overflow: hidden;
148
+ background-color: #000;
149
+ border: 3px solid #333;
150
+ border-radius: 8px;
151
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
152
+ transition: transform 0.3s ease;
153
+ }
154
+ .thumbnail video {
155
+ position: absolute;
156
+ top: 0;
157
+ left: 0;
158
+ width: 100%;
159
+ height: 100%;
160
+ object-fit: cover;
161
+ }
162
+ .gallery {
163
+ display: grid;
164
+ grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
165
+ gap: 15px;
166
+ padding: 20px;
167
+ background: linear-gradient(45deg, #1a1a1a, #2c2c2c);
168
+ border-radius: 15px;
169
+ }
 
 
 
 
 
170
  .thumbnail:hover {
171
  transform: translateY(-5px) scale(1.02);
172
  box-shadow:
173
  0 8px 20px rgba(0, 0, 0, 0.8),
174
  0 0 0 1px rgba(255, 255, 255, 0.2);
175
  }
 
176
  .thumbnail:hover video {
177
  transform: scale(1.1);
178
  }
 
212
  </div>
213
 
214
  <script>
215
+
216
  // ๋น„๋””์˜ค ํŒŒ์ผ ๋ฐฐ์—ด์„ ์ˆ˜์ •ํ•˜์—ฌ ์ˆœ์ฐจ์ ์œผ๋กœ ํƒญ ๋ฒˆํ˜ธ ํ• ๋‹น
217
  const videoFiles = [
218
  // ์ฒซ ๋ฒˆ์งธ ๊ทธ๋ฃน (ํƒญ 1)
 
364
 
365
  { file: 'tmps_zu8c60.output.mp4', tab: 8 }
366
  ];
 
367
 
368
+
369
+ function createVideoElement(thumbnail, videoData) {
370
+ const thumbVideo = document.createElement('video');
371
+ thumbVideo.src = videoData.file;
372
+ thumbVideo.playsinline = true;
373
+ thumbVideo.muted = true;
374
+ thumbVideo.loop = true;
375
+ thumbVideo.preload = 'metadata';
376
+
377
+ thumbVideo.addEventListener('loadeddata', () => {
378
+ thumbVideo.currentTime = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
379
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
380
 
381
+ thumbVideo.addEventListener('error', (e) => {
382
+ console.error('Video loading error:', e);
383
+ thumbnail.style.backgroundColor = '#333';
384
+ });
 
385
 
386
+ thumbnail.addEventListener('mouseenter', () => {
387
+ thumbVideo.play().catch(e => console.log('Playback failed:', e));
388
+ });
389
 
390
+ thumbnail.addEventListener('mouseleave', () => {
391
+ thumbVideo.pause();
392
+ thumbVideo.currentTime = 0;
393
+ });
394
 
395
+ thumbnail.addEventListener('click', () => {
396
+ const selectedThumb = document.getElementById('selected-thumb');
397
+ const selectedVideo = document.getElementById('selected-video');
398
+
399
+ selectedThumb.src = videoData.file;
400
+ selectedVideo.src = videoData.file;
401
+ selectedVideo.play().catch(e => console.log('Playback failed:', e));
402
+ });
403
 
404
+ thumbnail.appendChild(thumbVideo);
405
+ }
406
 
407
+ function initializeGallery() {
408
+ const gallery = document.getElementById('video-gallery');
409
+ const selectedThumb = document.getElementById('selected-thumb');
410
+ const selectedVideo = document.getElementById('selected-video');
411
 
412
+ if (videoFiles.length > 0) {
413
+ selectedThumb.src = videoFiles[0].file;
414
+ selectedVideo.src = videoFiles[0].file;
415
+ }
 
416
 
417
+ videoFiles.forEach((videoData) => {
418
+ const thumbnail = document.createElement('div');
419
+ thumbnail.className = 'thumbnail';
420
+ thumbnail.dataset.tab = videoData.tab.toString();
421
+ createVideoElement(thumbnail, videoData);
422
+ gallery.appendChild(thumbnail);
423
+ });
 
 
424
 
425
+ showTabContent('1');
426
+ }
 
427
 
428
+ function showTabContent(tabNumber) {
429
+ const thumbnails = document.querySelectorAll('.thumbnail');
430
+ thumbnails.forEach(thumb => {
431
+ if (thumb.dataset.tab === tabNumber) {
432
+ thumb.style.display = 'block';
433
+ } else {
434
+ thumb.style.display = 'none';
435
+ }
436
+ });
437
  }
 
 
438
 
439
+ document.querySelectorAll('.tab-button').forEach(button => {
440
+ button.addEventListener('click', () => {
441
+ document.querySelectorAll('.tab-button').forEach(btn =>
442
+ btn.classList.remove('active'));
443
+ button.classList.add('active');
444
+ showTabContent(button.dataset.tab);
445
+ });
446
+ });
 
447
 
448
+ document.addEventListener('DOMContentLoaded', () => {
449
+ initializeGallery();
450
+ });
451
  </script>
452
  </body>
453
+ </html>
454
+
455
+
456
+