-
Notifications
You must be signed in to change notification settings - Fork 0
/
index1.html
388 lines (383 loc) · 8.62 KB
/
index1.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
<!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">
<title>Document</title>
<link rel="stylesheet" href="font/iconfont.css">
<style>
h3, h4 {
margin: 0;
padding: 0;
}
html {
height: 100%;
}
body {
margin: 0;
padding: 0;
height: 100%;
}
ul {
margin: 0;
padding: 0;
list-style: none;
}
.wrap {
display: flex;
height: 100%;
}
.left {
width: 100px;
overflow-y: auto;
transition: width 1s;
}
.left::-webkit-scrollbar {
display: none;
}
@keyframes large {
from {
width: 100px;
}
to {
width: 200px;
}
}
@keyframes large-rever {
from {
width: 200px;
}
to {
width: 100px;
}
}
/* .left:hover {
animation: large 1s 1 forwards;
} */
.main {
width: 600px;
background-color: rgb(240, 255, 236);
height: 100%;
overflow-y: auto;
}
.logo-wrap {
height: 100px;
margin-top: 25px;
margin-bottom: 20px;
}
.logo {
width: 50px;
height: 50px;
display: block;
margin: 0 auto;
animation: logo-rotate 3s linear infinite forwards;
transition: all 1s;
}
.left:hover .logo {
width: 45px;
height: 45px;
}
.left:hover {
width: 300px;
}
@keyframes logo-rotate {
from {
transform: rotate(0);
}
to {
transform: rotate(360deg);
}
}
/* .left:hover .logo {
animation: logo-ani 1s 1 forwards, logo-rotate 3s linear infinite forwards;
} */
@keyframes logo-ani {
from {
width: 50px;
height: 50px;
opacity: 1;
}
to {
width: 45px;
height: 45px;
opacity: 0.8;
}
}
@keyframes logo-ani-rever {
from {
width: 45px;
height: 45px;
opacity: 0.8;
}
to {
width: 50px;
height: 50px;
opacity: 1;
}
}
.logo-text {
width: 100px;
font-weight: bold;
margin: 0 auto;
opacity: 0;
transform: translateY(5px);
transition: all 1s;
}
.left:hover .logo-text {
transform: translateY(-5px);
opacity: 1;
}
/* @keyframes logo-text-ani {
from {
opacity: 0;
top: 21px;
}
to {
opacity: 1;
top: -5px;
}
}
@keyframes logo-text-ani-rever {
to {
opacity: 0;
top: 21px;
}
from {
opacity: 1;
top: -5px;
}
} */
.box {
margin: 0 5px;
}
.list {
display: flex;
flex-direction: column;
align-items: center;
}
.list-item {
width: 100px;
height: 38px;
margin-bottom: 80px;
display: flex;
flex-wrap: wrap;
align-items: center;
font-size: 16px;
color: rgb(66, 66, 66);
}
.list-item span {
/* position: relative; */
transform-origin: left;
transform: scale(1);
transition: transform 1s;
}
.list-item:hover span {
transform: scale(0.8);
}
.list-item:hover {
color:rgb(59, 97, 245)
}
/* @keyframes list-item-ani {
from {
left: 0;
transform: scale(1);
}
to {
left: 5px;
transform: scale(0.8);
}
}
@keyframes list-item-ani-reverse {
from {
left: 5px;
transform: scale(0.8) ;
}
to {
left: 0;
transform: scale(1);
}
} */
.detail {
width: 100px;
margin-left: 5px;
opacity: 0;
font-size: 14px;
transform: translateY(10px);
transition: all 1s;
}
.list-item:hover .detail {
transform: translateY(-2px);
opacity: 1;
}
/* @keyframes item-detail {
from {
opacity: 0;
top: 10px;
font-size: 14px;
}
to {
opacity: 1;
top: -2px;
font-size: 14px;
}
}
@keyframes item-detail-reverse {
from {
opacity: 1;
top: -2px;
font-size: 14px;
}
to {
opacity: 0;
top: 10px;
font-size: 14px;
}
} */
.list-item.active {
color: rgb(59, 97, 245);
}
/* .list-item.active .box{
background-color: rgb(59, 97, 245);
} */
.content {
width: 500px;
margin: 60px auto 0;
}
.content h2 {
margin-bottom: 25px;
}
@keyframes movein {
from {
transform: translateX(-50px);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
.content-item {
height: 80px;
background-color: #fff;
display: flex;
flex-direction: column;
justify-content: center;
padding-left: 20px;
margin-bottom: 40px;
border: 1px solid #eee;
opacity: 0;
animation: movein 1s forwards;
}
.content-item span {
color: #bbb;
margin-top: 5px;
}
.content-item:hover {
box-shadow:0 0 10px #ccc;
}
</style>
</head>
<body>
<div class="wrap">
<div class="left">
<div class="logo-wrap">
<img class="logo" src="logo.svg"></img>
<div class="logo-text">React 知命镜</div>
</div>
<ul class="list">
<li class="list-item active">
<span class="box iconfont icon-yk_fangkuai_fill"></span>
<span>basic</span>
<div class="detail">所有基础知识</div>
</li>
<li class="list-item">
<span class="box iconfont icon-yk_fangkuai_fill"></span>
<span>hooks</span>
<div class="detail">组件化新方案</div>
</li>
<li class="list-item">
<span class="box iconfont icon-yk_fangkuai_fill"></span>
<span>router</span>
<div class="detail">页面路由方案</div>
</li>
<li class="list-item">
<span class="box iconfont icon-yk_fangkuai_fill"></span>
<span>redux</span>
<div class="detail">状态管理方案</div>
</li class="list-item">
<li class="list-item">
<span class="box iconfont icon-yk_fangkuai_fill"></span>
<span>mobx</span>
<div class="detail">状态管理方案</div>
</li class="list-item">
<li class="list-item">
<span class="box iconfont icon-yk_fangkuai_fill"></span>
<span>TS</span>
<div class="detail">类型约束升级</div>
</li>
<li class="list-item">
<span class="box iconfont icon-yk_fangkuai_fill"></span>
<span>practice</span>
<div class="detail">各种练习项目</div>
</li>
</ul>
</div>
<div class="main">
<div class="content">
<h2>
React 基础知识
</h2>
</div>
</div>
</div>
<script>
const arr = []
const item = {
title: 'react',
text: 'hello world'
}
for (let i = 0; i < 10; i++) {
arr.push(item)
}
let content = document.querySelector('.content')
arr.forEach((item, index) => {
const title = document.createElement('h4')
let contentItem = document.createElement('div')
const itemTitle = document.createElement('h3')
itemTitle.innerHTML = item.title
let itemText = document.createElement('span')
itemText.innerHTML = item.text
contentItem.append(itemTitle, itemText)
contentItem.className = 'content-item'
contentItem.style.animationDelay = `${index * 0.2}s`
content.append(contentItem)
})
const list = document.querySelector('.list')
const items = document.querySelectorAll('.list-item')
// // list.addEventListener('mouseover', function(event) {
// // console.dir(event.target)
// // })
items.forEach((item) => {
item.addEventListener('mouseout', function() {
this.classList.remove('active')
})
item.addEventListener('mouseover', function() {
items[0].classList.remove('active')
this.classList.add('active')
})
})
const left = document.querySelector('.left')
// const logo = document.querySelector('.logo')
// const logoText = document.querySelector('.logo-text')
// left.addEventListener('mouseover', function () {
// console.log(1)
// })
left.addEventListener('mouseout', function () {
if (!items[0].classList.contains('active')) {
items[0].classList.add('active')
}
})
</script>
</body>
</html>