forked from wuyawei/fe-code
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
90 lines (89 loc) · 2.06 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<style>
html,body{
width:100%;
height: 100%;
margin: 0;
padding: 0;
}
/*.container {*/
/*width:100%;*/
/*height: 100%;*/
/*display: grid;*/
/*grid-template-columns: 300px auto 300px;*/
/*grid-template-rows: auto;*/
/*}*/
/*.item-1{*/
/*background-color: #17f8be;*/
/*}*/
/*.item-2{*/
/*background-color: #00acec;*/
/*}*/
/*.item-3{*/
/*background-color: #FF0000;*/
/*}*/
.container{
width: 500px;
height: 500px;
position: relative;
/* grid-template-columns: 250px 250px;
grid-template-rows: auto; */
/*grid-column-gap: 10px;*/
/*grid-row-gap: 10px;*/
/* grid-gap: 10px 10px; */
/*justify-items: end;*/
/* border: 2px solid #17f8be; */
}
.item{
width: 100%;
height: 100%;
position: absolute;
left:0;
top: 0;
}
.item:nth-child(1){
background-color: #2bfbd8;
display: block;
}
.item:nth-child(2){
background-color: #f3880d;
display: none;
}
.item:nth-child(3){
background-color: #00acec;
display: none;
}
</style>
<body>
<!--<div class="container">-->
<!--<div class="item item-1"></div>-->
<!--<div class="item item-2"></div>-->
<!--<div class="item item-3"></div>-->
<!--</div>-->
<div class="container">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
</body>
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<script>
$(function() {
let index = 0;
const childs = $('.container').children();
setInterval(() => {
++ index;
if (index > childs.length-1) {
index = 0;
}
$('.container').children().fadeOut(1000);
$(childs[index]).fadeIn(800);
}, 2000)
})
</script>
</html>