-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
70 lines (55 loc) · 1.05 KB
/
index.js
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
58
59
60
61
62
63
64
65
66
67
68
69
70
function topSliderImg() {
const arr = [
"./slid/1.png",
"./slid/2.png",
"./slid/3.png",
"./slid/4.png",
"./slid/5.png",
"./slid/6.png",
"./slid/7.png",
];
let i = 0;
let div = document.getElementById("slider1");
let img = document.createElement("img");
img.src = arr[0];
div.append(img);
i++;
setInterval(function () {
if (i == 7) {
i = 0;
}
img.src = arr[i];
i++;
div.append(img);
}, 3000);
}
topSliderImg();
// bottom slider
function bottomSliderImg() {
const arr = [
"./slid2/1.png",
"./slid2/2.png",
"./slid2/3.png",
"./slid2/4.png",
];
let i = 0;
let div = document.getElementById("slider2");
let img = document.createElement("img");
img.src = arr[0];
div.append(img);
i++;
setInterval(function () {
if (i == 4) {
i = 0;
}
img.src = arr[i];
i++;
div.append(img);
}, 3000);
}
bottomSliderImg();
function show() {
for (i = 1; i <= 4; i++) {
document.getElementById("c" + i).style.display = "inline-block";
}
}