Spaces:
Running
Running
Update index.html
Browse files- index.html +151 -18
index.html
CHANGED
@@ -1,19 +1,152 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
</html>
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Fullscreen Crossfade Slideshow with Audio</title>
|
7 |
+
<style>
|
8 |
+
* { margin: 0; padding: 0; }
|
9 |
+
html, body { width: 100%; height: 100%; overflow: hidden; }
|
10 |
+
|
11 |
+
#slideshow {
|
12 |
+
position: relative;
|
13 |
+
width: 100%;
|
14 |
+
height: 100%;
|
15 |
+
cursor: pointer;
|
16 |
+
background-color: white;
|
17 |
+
}
|
18 |
+
.slide {
|
19 |
+
position: absolute;
|
20 |
+
top: 0;
|
21 |
+
left: 0;
|
22 |
+
width: 100%;
|
23 |
+
height: 100%;
|
24 |
+
object-fit: cover;
|
25 |
+
transition: opacity 2s ease-in-out;
|
26 |
+
}
|
27 |
+
.slide.hidden {
|
28 |
+
opacity: 0;
|
29 |
+
z-index: 1;
|
30 |
+
}
|
31 |
+
.slide.visible {
|
32 |
+
opacity: 1;
|
33 |
+
z-index: 2;
|
34 |
+
}
|
35 |
+
.white-background {
|
36 |
+
background: white;
|
37 |
+
object-fit: cover;
|
38 |
+
transform: scaleY(5);
|
39 |
+
}
|
40 |
+
</style>
|
41 |
+
</head>
|
42 |
+
<body>
|
43 |
+
<div id="slideshow">
|
44 |
+
<img id="slide1" class="slide visible" src="https://huggingface.co/datasets/vericudebuget/test1423/resolve/main/WhatsApp%20Image%202025-05-16%20at%203.03.14%20PM.jpeg" alt="">
|
45 |
+
<img id="slide2" class="slide hidden" src="" alt="">
|
46 |
+
</div>
|
47 |
+
|
48 |
+
<audio id="bgAudio" preload="auto" style="display:none;">
|
49 |
+
<source src="https://huggingface.co/datasets/vericudebuget/test1423/resolve/main/ytmp3free.cc_corul-buna-vestire-francisc-hubic-miluiestema-dumnezeule-gheorghe-cucu-youtubemp3free.o%20(1).mp3?download=true" type="audio/mpeg">
|
50 |
+
</audio>
|
51 |
+
|
52 |
+
<script>
|
53 |
+
const images = [
|
54 |
+
'https://huggingface.co/datasets/vericudebuget/test1423/resolve/main/WhatsApp%20Image%202025-05-16%20at%203.03.14%20PM.jpeg',
|
55 |
+
'https://huggingface.co/datasets/vericudebuget/test1423/resolve/main/WhatsApp%20Image%202025-05-16%20at%203.03.14%20PM%20(1).jpeg',
|
56 |
+
'https://huggingface.co/datasets/vericudebuget/test1423/resolve/main/WhatsApp%20Image%202025-05-16%20at%203.03.14%20PM%20(2).jpeg'
|
57 |
+
];
|
58 |
+
images.forEach(url => new Image().src = url);
|
59 |
+
|
60 |
+
const slide1 = document.getElementById('slide1');
|
61 |
+
const slide2 = document.getElementById('slide2');
|
62 |
+
const slideshow = document.getElementById('slideshow');
|
63 |
+
const bgAudio = document.getElementById('bgAudio');
|
64 |
+
bgAudio.volume = 0;
|
65 |
+
|
66 |
+
const slides = [
|
67 |
+
{ type: 'image', src: images[0] },
|
68 |
+
{ type: 'image', src: images[1] },
|
69 |
+
{ type: 'audio' },
|
70 |
+
{ type: 'image', src: images[2] },
|
71 |
+
{ type: 'white' }
|
72 |
+
];
|
73 |
+
|
74 |
+
let currentIndex = 0;
|
75 |
+
let isAudioPlaying = false;
|
76 |
+
|
77 |
+
slideshow.addEventListener('click', () => {
|
78 |
+
const nextIndex = (currentIndex + 1);
|
79 |
+
const nextSlide = slides[nextIndex];
|
80 |
+
|
81 |
+
if (!nextSlide) return;
|
82 |
+
|
83 |
+
if (nextSlide.type === 'audio') {
|
84 |
+
bgAudio.currentTime = 0;
|
85 |
+
bgAudio.play();
|
86 |
+
isAudioPlaying = true;
|
87 |
+
fadeVolume(bgAudio, 0, 1, 3000);
|
88 |
+
|
89 |
+
} else if (nextSlide.type === 'image') {
|
90 |
+
const topSlide = slide1.classList.contains('visible') ? slide1 : slide2;
|
91 |
+
const bottomSlide = topSlide === slide1 ? slide2 : slide1;
|
92 |
+
|
93 |
+
const prevIdx = slides.findIndex(s => s.src === topSlide.src);
|
94 |
+
const newIdx = images.indexOf(nextSlide.src);
|
95 |
+
const duration = (prevIdx === 1 && newIdx === 2) ? 5 : 2;
|
96 |
+
slide1.style.transition = `opacity ${duration}s ease-in-out`;
|
97 |
+
slide2.style.transition = `opacity ${duration}s ease-in-out`;
|
98 |
+
|
99 |
+
bottomSlide.src = nextSlide.src;
|
100 |
+
bottomSlide.alt = "";
|
101 |
+
bottomSlide.classList.remove('white-background');
|
102 |
+
bottomSlide.classList.remove('hidden');
|
103 |
+
bottomSlide.classList.add('visible');
|
104 |
+
topSlide.classList.remove('visible');
|
105 |
+
topSlide.classList.add('hidden');
|
106 |
+
|
107 |
+
} else if (nextSlide.type === 'white') {
|
108 |
+
fadeVolume(bgAudio, bgAudio.volume, 0, 10000);
|
109 |
+
const topSlide = slide1.classList.contains('visible') ? slide1 : slide2;
|
110 |
+
const bottomSlide = topSlide === slide1 ? slide2 : slide1;
|
111 |
+
|
112 |
+
bottomSlide.removeAttribute('src');
|
113 |
+
bottomSlide.alt = "";
|
114 |
+
bottomSlide.classList.add('white-background');
|
115 |
+
bottomSlide.style.transition = 'opacity 10s ease-in-out';
|
116 |
+
topSlide.style.transition = 'opacity 10s ease-in-out';
|
117 |
+
|
118 |
+
bottomSlide.classList.remove('hidden');
|
119 |
+
bottomSlide.classList.add('visible');
|
120 |
+
topSlide.classList.remove('visible');
|
121 |
+
topSlide.classList.add('hidden');
|
122 |
+
}
|
123 |
+
|
124 |
+
currentIndex = nextIndex;
|
125 |
+
});
|
126 |
+
|
127 |
+
function fadeVolume(audio, from, to, duration) {
|
128 |
+
const steps = 30;
|
129 |
+
const stepTime = duration / steps;
|
130 |
+
let step = 0;
|
131 |
+
const volumeStep = (to - from) / steps;
|
132 |
+
const fade = setInterval(() => {
|
133 |
+
audio.volume = Math.min(Math.max(audio.volume + volumeStep, 0), 1);
|
134 |
+
if (++step >= steps) clearInterval(fade);
|
135 |
+
if (audio.volume === 0) audio.pause();
|
136 |
+
}, stepTime);
|
137 |
+
}
|
138 |
+
|
139 |
+
document.addEventListener('keydown', (e) => {
|
140 |
+
if (e.key.toLowerCase() === 'k') {
|
141 |
+
if (bgAudio.paused) {
|
142 |
+
bgAudio.play();
|
143 |
+
isAudioPlaying = true;
|
144 |
+
} else {
|
145 |
+
bgAudio.pause();
|
146 |
+
isAudioPlaying = false;
|
147 |
+
}
|
148 |
+
}
|
149 |
+
});
|
150 |
+
</script>
|
151 |
+
</body>
|
152 |
</html>
|