Skip to content

Commit aaf5252

Browse files
authored
Add files via upload
1 parent 932a2fc commit aaf5252

File tree

8 files changed

+65
-0
lines changed

8 files changed

+65
-0
lines changed
Loading
Loading
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<link rel="stylesheet" href="styles.css">
8+
<title>JS Image Slider</title>
9+
</head>
10+
<body>
11+
<h1>JS Image Slider</h1>
12+
<div class"center">
13+
<img name="slide" width="400" height="200">
14+
</div>
15+
16+
17+
<script>
18+
var i = 0; // Start point
19+
var images = [];
20+
var time = 1000;
21+
22+
// Image List
23+
images[0] = 'code1.jpeg';
24+
images[1] = 'code2.jpeg';
25+
images[2] = 'code3.jpeg';
26+
images[3] = 'code4.jpeg';
27+
images[4] = 'code5.jpeg';
28+
images[5] = 'code6.jpg';
29+
30+
// Change Image
31+
function changeImg(){
32+
document.slide.src = images[i];
33+
34+
if(i < images.length - 1){
35+
i++;
36+
} else {
37+
i = 0;
38+
}
39+
40+
setTimeout("changeImg()", time);
41+
}
42+
43+
window.onload = changeImg;
44+
45+
</script>
46+
47+
48+
</body>
49+
</html>
50+
51+
52+
53+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
div{
2+
text-align: center;
3+
margin-top: 250px;
4+
}
5+
6+
h1{
7+
text-align: center;
8+
}
9+
10+
*{
11+
background-color: rgb(46, 46, 133);
12+
}

0 commit comments

Comments
 (0)