Skip to content

Commit 7d7266b

Browse files
committed
Add random image displaying
1 parent 1ae17d6 commit 7d7266b

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

assets/b.webp

333 KB
Binary file not shown.

images.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const images = document.querySelectorAll('.rounded-img');
2+
const randomIndex = Math.floor(Math.random() * images.length);
3+
images[randomIndex].classList.add('active');

index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ <h1>TimeKeeper</h1>
3636
<h2 class="prog_header">Рабочий трекер без лишних функций.</h2>
3737
<a href="./download.html" class="download-button">Скачать (Windows, Linux)</a>
3838
<img src="./assets/a.webp" class="rounded-img">
39+
<img src="./assets/b.webp" class="rounded-img">
3940
</div>
4041

4142
<div align="center">
@@ -87,6 +88,7 @@ <h3>Ведение статистики</h3>
8788
</footer>
8889

8990
<script src="hdr.js"></script>
91+
<script src="images.js"></script>
9092
</body>
9193

9294
</html>

style.css

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ img.screenshot.enlarged {
144144

145145
img.rounded-img {
146146
border-radius: 10px;
147+
display: none;
148+
}
149+
150+
img.rounded-img.active {
151+
display: block;
147152
}
148153

149154
nav {
@@ -157,7 +162,7 @@ nav {
157162
align-items: center;
158163
justify-content: space-between;
159164
backdrop-filter: blur(10px);
160-
background-color: rgba(60,56,54,0.7);
165+
background-color: rgba(60, 56, 54, 0.7);
161166
}
162167

163168
nav ul {
@@ -252,7 +257,7 @@ nav a:hover {
252257
background-color: #3c3836;
253258
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
254259
backdrop-filter: blur(10px);
255-
background-color: rgba(60,56,54,0.7);
260+
background-color: rgba(60, 56, 54, 0.7);
256261
}
257262

258263
nav ul.show li {
@@ -453,4 +458,4 @@ blockquote {
453458
.advantages-grid {
454459
grid-template-columns: 1fr;
455460
}
456-
}
461+
}

0 commit comments

Comments
 (0)