soiz1 commited on
Commit
49ec5d2
·
verified ·
1 Parent(s): 1e9105a

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +16 -16
index.html CHANGED
@@ -700,22 +700,22 @@
700
  let normalVideoWidth = videoContainer.clientWidth;
701
  let audioOnlyMode = false;
702
 
703
- // ホバー時の時間表示
704
- function setupHoverTime() {
705
- progressContainer.addEventListener('mousemove', (e) => {
706
- if (!video.duration) return;
707
-
708
- const rect = progressContainer.getBoundingClientRect();
709
- const pos = (e.clientX - rect.left) / rect.width;
710
- const time = pos * video.duration;
711
-
712
- hoverTime.style.display = 'block';
713
- hoverTime.style.left = `${e.clientX - rect.left}px`;
714
-
715
- const minutes = Math.floor(time / 60);
716
- const seconds = Math.floor(time % 60).toString().padStart(2, '0');
717
- hoverTime.textContent = `${minutes}:${seconds}`;
718
- });
719
 
720
  progressContainer.addEventListener('mouseleave', () => {
721
  hoverTime.style.display = 'none';
 
700
  let normalVideoWidth = videoContainer.clientWidth;
701
  let audioOnlyMode = false;
702
 
703
+ const previewVideo = document.getElementById("previewVideo");
704
+ previewVideo.src = video.src;
705
+ previewVideo.preload = "auto";
706
+
707
+ progressContainer.addEventListener("mousemove", (e) => {
708
+ if (!video.duration) return;
709
+
710
+ const rect = progressContainer.getBoundingClientRect();
711
+ const hoverTimeSec = (e.clientX - rect.left) / rect.width * video.duration;
712
+
713
+ // プレビュー用video設定
714
+ previewVideo.currentTime = hoverTimeSec;
715
+ previewVideo.style.display = "block";
716
+ previewVideo.style.left = `${e.clientX - 80}px`; // 中央揃え調整
717
+ previewVideo.style.top = `${rect.top - 100}px`; // 上に配置(必要に応じて調整)
718
+ });
719
 
720
  progressContainer.addEventListener('mouseleave', () => {
721
  hoverTime.style.display = 'none';