Spaces:
Running
Running
Update index.html
Browse files- index.html +121 -77
index.html
CHANGED
|
@@ -140,42 +140,45 @@
|
|
| 140 |
height: 100%;
|
| 141 |
object-fit: contain;
|
| 142 |
}
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
.thumbnail:hover {
|
| 165 |
transform: translateY(-5px) scale(1.02);
|
| 166 |
box-shadow:
|
| 167 |
0 8px 20px rgba(0, 0, 0, 0.8),
|
| 168 |
0 0 0 1px rgba(255, 255, 255, 0.2);
|
| 169 |
}
|
| 170 |
-
|
| 171 |
-
position: absolute;
|
| 172 |
-
top: 0;
|
| 173 |
-
left: 0;
|
| 174 |
-
width: 100%;
|
| 175 |
-
height: 100%;
|
| 176 |
-
object-fit: cover;
|
| 177 |
-
transition: transform 0.3s ease;
|
| 178 |
-
}
|
| 179 |
.thumbnail:hover video {
|
| 180 |
transform: scale(1.1);
|
| 181 |
}
|
|
@@ -400,54 +403,95 @@ const videoFiles = [
|
|
| 400 |
selectedThumb.currentTime = 0;
|
| 401 |
}
|
| 402 |
}
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
document.
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 449 |
}
|
| 450 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 451 |
</script>
|
| 452 |
</body>
|
| 453 |
</html>
|
|
|
|
| 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 |
}
|
|
|
|
| 403 |
selectedThumb.currentTime = 0;
|
| 404 |
}
|
| 405 |
}
|
| 406 |
+
function createVideoElement(thumbnail, videoData, autoload) {
|
| 407 |
+
const thumbVideo = document.createElement('video');
|
| 408 |
+
thumbVideo.src = videoData.file; // 직접 src 설정
|
| 409 |
+
thumbVideo.playsinline = true;
|
| 410 |
+
thumbVideo.muted = true;
|
| 411 |
+
thumbVideo.loop = true; // 반복 재생 추가
|
| 412 |
+
thumbVideo.preload = 'metadata';
|
| 413 |
+
|
| 414 |
+
// 비디오 로드 완료 후 처리
|
| 415 |
+
thumbVideo.addEventListener('loadeddata', () => {
|
| 416 |
+
thumbVideo.currentTime = 0;
|
| 417 |
+
});
|
| 418 |
+
|
| 419 |
+
// 에러 처리 추가
|
| 420 |
+
thumbVideo.addEventListener('error', (e) => {
|
| 421 |
+
console.error('Video loading error:', e);
|
| 422 |
+
thumbnail.style.backgroundColor = '#333';
|
| 423 |
+
});
|
| 424 |
+
|
| 425 |
+
thumbnail.addEventListener('mouseenter', () => {
|
| 426 |
+
thumbVideo.play().catch(e => console.log('Playback failed:', e));
|
| 427 |
+
});
|
| 428 |
+
|
| 429 |
+
thumbnail.addEventListener('mouseleave', () => {
|
| 430 |
+
thumbVideo.pause();
|
| 431 |
+
thumbVideo.currentTime = 0;
|
| 432 |
+
});
|
| 433 |
+
|
| 434 |
+
thumbnail.addEventListener('click', () => {
|
| 435 |
+
const selectedThumb = document.getElementById('selected-thumb');
|
| 436 |
+
const selectedVideo = document.getElementById('selected-video');
|
| 437 |
+
|
| 438 |
+
selectedThumb.src = videoData.file;
|
| 439 |
+
selectedVideo.src = videoData.file;
|
| 440 |
+
selectedVideo.play().catch(e => console.log('Playback failed:', e));
|
| 441 |
+
});
|
| 442 |
+
|
| 443 |
+
thumbnail.appendChild(thumbVideo);
|
| 444 |
+
}
|
| 445 |
+
|
| 446 |
+
function initializeGallery() {
|
| 447 |
+
const gallery = document.getElementById('video-gallery');
|
| 448 |
+
const selectedThumb = document.getElementById('selected-thumb');
|
| 449 |
+
const selectedVideo = document.getElementById('selected-video');
|
| 450 |
+
|
| 451 |
+
// 초기 비디오 설정
|
| 452 |
+
if (videoFiles.length > 0) {
|
| 453 |
+
selectedThumb.src = videoFiles[0].file;
|
| 454 |
+
selectedVideo.src = videoFiles[0].file;
|
| 455 |
+
}
|
| 456 |
+
|
| 457 |
+
// 모든 비디오 썸네일 생성
|
| 458 |
+
videoFiles.forEach((videoData) => {
|
| 459 |
+
const thumbnail = document.createElement('div');
|
| 460 |
+
thumbnail.className = 'thumbnail';
|
| 461 |
+
thumbnail.dataset.tab = videoData.tab;
|
| 462 |
+
|
| 463 |
+
createVideoElement(thumbnail, videoData, true);
|
| 464 |
+
gallery.appendChild(thumbnail);
|
| 465 |
+
});
|
| 466 |
+
|
| 467 |
+
// 첫 번째 탭 컨텐츠 표시
|
| 468 |
+
showTabContent('1');
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
// 탭 컨텐츠 표시 함수
|
| 472 |
+
function showTabContent(tabNumber) {
|
| 473 |
+
const thumbnails = document.querySelectorAll('.thumbnail');
|
| 474 |
+
thumbnails.forEach(thumb => {
|
| 475 |
+
if (thumb.dataset.tab === tabNumber) {
|
| 476 |
+
thumb.style.display = 'block';
|
| 477 |
+
} else {
|
| 478 |
+
thumb.style.display = 'none';
|
| 479 |
}
|
| 480 |
+
});
|
| 481 |
+
}
|
| 482 |
+
|
| 483 |
+
// 탭 버튼 이벤트 리스너
|
| 484 |
+
document.querySelectorAll('.tab-button').forEach(button => {
|
| 485 |
+
button.addEventListener('click', () => {
|
| 486 |
+
document.querySelectorAll('.tab-button').forEach(btn =>
|
| 487 |
+
btn.classList.remove('active'));
|
| 488 |
+
button.classList.add('active');
|
| 489 |
+
showTabContent(button.dataset.tab);
|
| 490 |
+
});
|
| 491 |
+
});
|
| 492 |
+
|
| 493 |
+
// 갤러리 초기화
|
| 494 |
+
initializeGallery();
|
| 495 |
</script>
|
| 496 |
</body>
|
| 497 |
</html>
|