-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
57 lines (40 loc) · 1.9 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="styles.css" />
<title>Slideshow</title>
</head>
<body>
<script>
document.addEventListener('keydown', (event) => {
var key = event.code;
if (key === "ArrowLeft") {prevSlide()}
else if (key === "ArrowRight") {nextSlide()}
}, false)
var currentId = 0;
var maxId = 1;
function nextSlide() {
if (currentId == maxId) {currentId = 0;}
else {currentId = currentId + 1}
}
function prevSlide() {
if (currentId == 0) {currentId = maxId}
else {currentId = currentId - 1}
}
var interval = setInterval(() => {
for (let i = 0; i <= maxId; i++) {
var img = document.getElementById(i.toString());
img.style.opacity = 0;
if (i === currentId) {img.style.opacity = 1;}
}
}, 100)
</script>
<iframe id="0" class="slide" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSN6ezPL3qZI09ny9foy-nQQOSefqFDVv1_1cV7JqCMVQ&s">You don't work</iframe>
<iframe id="1" class="slide" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQAhAPGUR-KfyPqbOmkjxSSCYV5Wy6aFQjIKV0MVmjDG0OCXnP1_zW4EyjVwyHonkscLWo:https://media.sproutsocial.com/uploads/2017/02/10x-featured-social-media-image-size.png&usqp=CAU">You don't work</iframe>
<button onclick="nextSlide()" class="leftButton noStyle"></button>
<button onclick="prevSlide()" class="rightButton noStyle"></button>
</body>
</html>