老师,帮我看下错在哪里了

老师,帮我看下错在哪里了

老师,第一屏和第二屏动画都不对,能帮忙看下哪里错了吗


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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="css/index.css">
<link rel="stylesheet" type="text/css" href="css/base.css">
    <link rel="stylesheet" type="text/css" href="css/animate.css">
</head>
<body>
<!--导航条区域-->
<header class="header">
    <div class="header__wrap">
        <div class="header__logo">H5实战页面</div>
        <nav class="header__nav">
            <a href="javascript:;" class="header__nav-item  header__nav-item_status_active">实战课程</a>
            <a href="javascript:;" class="header__nav-item">商业案例</a>
            <a href="javascript:;" class="header__nav-item">课程体系</a>
            <a href="javascript:;" class="header__nav-item">集成环境</a>
            <a href="javascript:;" class="header__nav-item">云端学习</a>
            <a href="javascript:;" class="header__nav-item  header__nav-item_custom_button">即刻学习</a>
            <div class="header__nav-tip"></div>
        </nav>
    </div>
</header>
<div class="screen-1">
        <h2 class="screen-1__heading  screen-1__heading_animate_init">实战课程重磅上线</h2>
        <h3 class="screen-1__subheading screen-1__subheading_animate_init">一键云学习,还在等什么?</h3>
    </div>
    <div class="screen-2">
        <h2 class="screen-2__heading">每门课都是真实商业案例</h2>
        <h3 class="screen-2__subheading">真实案例、真实场景,在实战中实践、操作、调试<br>大牛带你体验BAT真实开发流程,所有开发过程——为你呈现</h3>
        <div class="screen-2__BAT">
         <div class="screen-2__point1"></div>
            <div class="screen-2__point2"></div>
        </div>
    </div>
    <div class="screen-3">
     <div class="screen-3__bg screen-3__bg_animate_init"></div>
        <div class="screen-3__wrap">
            <h2 class="screen-3__heading screen-3__heading_animate_init">强大的语言课程体系支持</h2>
            <h3 class="screen-3__subheading">学习环境与课程轻松对接,安装、调试、写入、部署、运营,一站式解决<br> 让你体验开发全流程</h3>
            <div class="screen-3__features">
                <div class="screen-3__features__item  screen-3__features__item1">
                    <div class="screen-3__features__item__number">HTML5</div>
                </div>
                <div class="screen-3__features__item  screen-3__features__item2">
                    <div class="screen-3__features__item__number">PHP</div>
                </div>
                <div class="screen-3__features__item  screen-3__features__item3">
                    <div class="screen-3__features__item__number">JAVA</div>
                </div>
                <div class="screen-3__features__item  screen-3__features__item4">
                    <div class="screen-3__features__item__number">Python</div>
                </div>
                <div class="screen-3__features__item  screen-3__features__item5">
                    <div class="screen-3__features__item__number">Node.js</div>
                </div>
            </div>
        </div>
    </div>
    <div class="screen-4">
        <div class="screen-4__wrap">
            <h2 class="screen-4__heading">省去本地复杂的环境搭建</h2>
            <h3 class="screen-4__subheading">你可以告别在虚拟机中调试开发了</h3>
            <div class="screen-4__type">
                <div class="screen-4__type__item">
                 <div class="screen-4__type__item_img  screen-4__type__item_img1"></div>
                    <div class="screen-4__type__item__txt">实战课程集成开发环境</div>
                </div>
                <div class="screen-4__type__item">
                 <div class="screen-4__type__item_img  screen-4__type__item_img2"></div>
                    <div class="screen-4__type__item__txt">内置终端命令行</div>
                </div>
                <div class="screen-4__type__item">
                 <div class="screen-4__type__item_img  screen-4__type__item_img3"></div>
                    <div class="screen-4__type__item__txt">编译你的应用程序</div>
                </div>
                <div class="screen-4__type__item">
                 <div class="screen-4__type__item_img  screen-4__type__item_img4"></div>
                    <div class="screen-4__type__item__txt">通过云端服务输出效果</div>
                </div>
            </div>
        </div>
    </div>
    <div class="screen-5">
     <div class="screen-5__pic"></div>
        <h2 class="screen-5__heading">云端学习可以这样简单</h2>
        <h3 class="screen-5__subheading">看视频,敲代码一气呵成,结合慕课网为您提供的云端学习工具,所见即所得。从此学习不一样</h3>
    </div>
    <div class="screen-learn">
     <a class="screen-learn-button" href="javascript:;">继续了解学习体验</a>
    </div>
    <footer class="footer">
     <ul class="footer__nav">
     <li class="footer__nav__item">网站首页</li>
     <li class="footer__nav__item">人才招聘</li>
     <li class="footer__nav__item">联系我们</li>
     <li class="footer__nav__item">高校联盟</li>
     <li class="footer__nav__item">关于我们</li>
     <li class="footer__nav__item">讲师招聘</li>
     <li class="footer__nav__item">意见反馈</li>
     <li class="footer__nav__item">友情链接</li>
     </ul>
     <p>© 2015 imooc.com All Rights Reserved 京ICP备 13046642号-2</p>
    </footer>
    <div class="outline">
        <a href="javascript:;" class="outline__item">实</a>
        <a href="javascript:;" class="outline__item">商</a>
        <a href="javascript:;" class="outline__item">课</a>
        <a href="javascript:;" class="outline__item">集</a>
        <a href="javascript:;" class="outline__item">云</a>
    </div>  
</body>
</html>

animate.css部分

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
.screen-1__heading,
.screen-1__subheading{
    transition: all 1s;
}
.screen-1__subheading{
    transition-delay:1s;
}
.screen-1__heading_animate_init,
.screen-1__subheading_animate_init{
    opacity: 0;
    transform: translate(0,100%);
}
.screen-1__heading_animate_done,
.screen-1__subheading_animate_done{
    opacity: 1;
    transform: translate(0,0);
}
 
/*第二屏动画*/
.screen-2__heading,
.screen-2__subheading,
.screen-2__point1{
    transition: all 1s;
}
.screen-2__heading_animate_init,
.screen-2__subheading_animate_init{
    opacity: 0;
    transform: translate(0,100%);
}
.screen-2__heading_animate_done,
.screen-2__subheading_animate_done{
    opacity: 1;
    transform: translate(0,0);
}
.screen-2__point2_animate_init{
    opacity: 0;
}
.screen-2__point2_animate_done{
    opacity: 1;
}

index.css部分

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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
/*头部*/
.header__wrap{
    width:1200px;
    height40px;
    margin10px auto;
    positionrelative;
    z-index3;
}
.header__logo{
    width150px;
    height40px;
    line-height40px;
    font-size15px;
    color#fff;
    text-indent50px;
    backgroundurl('../img/logo.png'left center no-repeat;
    background-size38px 38px;
    font-weightbold;
    margin-left-65px;
}
.header__nav{
    positionabsolute;
    right-70px;
    height38px;
    top50%;
    margin-top-19px;
}
.header__nav-item{
    color#fff;
    font-size14px;
    displayblock;
    height40px;
    line-height40px;
    floatleft;
    positionrelative;
    width60px;
    text-aligncenter;
    margin0 20px;
}
.header__nav-item:hover{
    font-weightbold;
}
.header__nav-item_status_active{
    font-weightbold;
}
.header__nav-item_status_active::after{
    content' ';
    displayblock;
    width100%;
    height2px;
    positionabsolute;
    background-color:#f01400
    left0;
    bottom0;
}
.header__nav-item_custom_button{
    backgroundred;
    text-aligncenter;
    width85px;
    border-radius: 5px;
    padding0;
}
 
/*第一屏*/
.screen-1{
    height640px;
    overflowhidden;
    background:url(../img/sc1.jpg) no-repeat center;
    background-size: cover;
    margin0 auto;
    margin-top-60px;
}
.screen-1__heading{
    color#fff;
    text-aligncenter;
    font-size30px;
    margin-top240px;
}
.screen-1__subheading{
    color#fff;
    text-aligncenter;
    font-weightnormal;
}
 
/*第二屏*/
.screen-2{
    height640px;
    positionrelative;
    overflowhidden;
    background-color#f3f5f7;
    margin0 auto;
}
.screen-2__heading{
    font-size:36px;
    line-height36px;
    color#000;
    font-weightbold;
    text-aligncenter;
    padding-top90px;
}
.screen-2__heading::after{
    content' ';
    displayblock;
    width40px;
    height2px;
    positionabsolute;
    background-color#f01400;
    top167px;
    left50%;
    margin-left-20px;
}
.screen-2__subheading{
    font-size:14px;
    color#000;
    text-aligncenter;
    padding-top35px;
    line-height18px;
    positionabsolute;
    left50%;
    margin-left-189px;
    top165px;
}
.screen-2__BAT{
    width750px;
    height361px;
    background:url(../img/sc2.png) no-repeat center;
    positionabsolute;
    bottom0;
    left50%;
    margin-left-375px;
}
.screen-2__point1{
    width266px;
    height205px;
    backgroundurl(../img/sc2-2.png) no-repeat center;
    positionabsolute;
    left340px;
    top400px;
}
.screen-2__point2{
    width275px;
    height380px;
    backgroundurl(../img/sc2-1.png) no-repeat center;
    positionabsolute;
    left50%;
    margin-left-137px;
    bottom0;
}
 
/*第三屏*/
.screen-3{
    height640px;
    positionrelative;
    overflowhidden;
    background-color#2b333b;
    margin0 auto;
}
.screen-3__bg{
    width580px;
    height640px;
    backgroundurl(../img/sc3.png) no-repeat center;
    floatleft;
    margin-left50px;
    background-size: cover;
}
.screen-3__heading{
    font-size36px;
    color#fff;
    text-aligncenter;
    positionabsolute;
    left700px;
    top200px;
}
.screen-3__heading::after{
    content' ';
    displayblock;
    width40px;
    height2px;
    positionabsolute;
    background-color#f01400
    top80px;
    left5px;
}
.screen-3__subheading{
    font-size14px;
    color#fff;
    positionabsolute;
    left700px;
    top320px;
}
.screen-3__features{
    width600px;
    height80px;
    positionabsolute;
    left700px;
    top500px
}
.screen-3__features__item{
    width:60px;
    height:60px;
    border-radius:100px;
    floatleft;
    margin-right30px;
}
.screen-3__features__item1{
    border:6px solid rgba(2,176,255,.5);
}
.screen-3__features__item2{
    border:6px solid rgba(79,125,253,.5);
}
.screen-3__features__item3{
    border:6px solid rgba(255,96,96,.5);
}
.screen-3__features__item4{
    border:6px solid rgba(34,199,229,.5);
}
.screen-3__features__item5{
    border:6px solid rgba(144,189,86,.5);
}
.screen-3__features__item:nth-child(1){
    color: rgba(2,176,255);
}
.screen-3__features__item:nth-child(2){
    color: rgba(79,125,253);
}
.screen-3__features__item:nth-child(3){
    color: rgba(255,96,96);
}
.screen-3__features__item:nth-child(4){
    color: rgba(34,199,229);
}
.screen-3__features__item:nth-child(5){
    color: rgba(144,189,86);
}
.screen-3__features__item__number{
    line-height60px;
    text-aligncenter
}
 
/*第四屏*/
.screen-4{
    background-color#f3f5f7;
    height640px;
    margin0 auto;
    overflowhidden;
    positionrelative;
}
.screen-4__wrap{
    width1200px;
    heightauto;
    margin0 auto;
 
}
.screen-4__heading{
    font-size36px;
    line-height36px;
    color#000;
    font-weightbold;
    text-aligncenter;
    padding-top120px;
}
.screen-4__heading::after{
    content' ';
    displayblock;
    width40px;
    height2px;
    positionabsolute;
    background-color#f01400;
    top187px;
    left50%;
    margin-left-20px;
}
.screen-4__subheading{
    font-size14px;
    color#000;
    padding-top35px;
    line-height18px;
    positionabsolute;
    left50%;
    margin-left-109px;
    top185px;
}
.screen-4__type{
    width1065px;
    height120px;
    positionabsolute;
    top354px;
    left25%;
}
.screen-4__type__item{
    width170px;
    height123px;
    floatleft;
}
.screen-4__type__item_img{
    width80px;
    height97px;
    margin0 auto;
}
.screen-4__type__item_img1{
 
    backgroundurl('../img/sc4-1.png'no-repeat left top;
}
.screen-4__type__item_img2{
 
    backgroundurl('../img/sc4-2.png'no-repeat left top;
}
.screen-4__type__item_img3{
 
    backgroundurl('../img/sc4-3.png'no-repeat left top;
}
.screen-4__type__item_img4{
 
    backgroundurl('../img/sc4-4.png'no-repeat left top;
}
.screen-4__type__item__txt{
    text-aligncenter;
}
 
/*第五屏*/
.screen-5{
    height640px;
    positionrelative;
    overflowhidden;
    backgroundurl('../img/sc5.jpg'no-repeat center;
    margin0 auto;
}
.screen-5__pic{
    width200px;
    height200px;
    backgroundurl('../img/sc5-1.png')  no-repeat center;
    margin100px auto 0;
}
.screen-5__heading{
    font-size36px;
    line-height36px;
    color#fff;
    font-weightbold;
    text-aligncenter;
    padding-top60px;
}
.screen-5__heading::after{
    content' ';
    displayblock;
    width40px;
    height2px;
    positionabsolute;
    background-color#fff;
    top430px;
    left50%;
    margin-left-20px;
}
.screen-5__subheading{
    font-size14px;
    color#fff;
    text-aligncenter;
    padding-top65px;
}
 
/*第六屏*/
.screen-learn{
    height200px;
    margin0 auto;
    positionrelative;
}
.screen-learn-button{
    border:1px solid rgba(112,112,112,.5);
    font-size20px;
    color#000;
    padding20px 30px;
    positionabsolute;
    top67px;
    left50%;
    margin-left-117px;
    border-radius: 5px;
}
.screen-learn-button:hover{
    background-colorred;
    color#fff;
    bordernone;
}
 
/*尾部*/
.footer{
    height100px;
    background-color#000;
    positionrelative;
    margin0 auto;
}
.footer__nav{
    width670px;
    height30px;
    positionabsolute;
    top18px;
    left50%;
    margin-left-355px;
}
.footer__nav__item{
    color#fff;
    floatleft;
    margin-right35px;
}
.footer__nav__item:hover{
    colorred;
    cursorpointer
}
.footer p{
    color#c8cdd2;
    font-size16px;
    positionabsolute;
    top50px;
    left50%;
    margin-left-236px;
}
 
/*侧边条*/
.outline {
    positionfixed;
    padding5px 10px;
    bottom120px;
    right0;
    z-index1;
    background-color#fff;
    box-shadow: 0px 4px 12px 0px rgba(717270.1);
    z-index3;
}
.outline__item {
    displayblock;
    width40px;
    height30px;
    line-height30px;
    padding5px 0;
    backgroundrgb(255,255,255);
    margin5px 0px 0px;
    border-top1px solid #eee;
    text-aligncenter;
    color#93999f;
}
.outline__item:first-child{
    border:none;
}
.outline__item:hover,
.outline__item_status_active{
    color#f00;
}

base.css部分

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
body{
    background-color#fff
    margin0;
    padding0;
    font-size12px;
    font-family"Microsoft Yahei",微软雅黑
}
a{
    text-decorationnone;
}
h2,h3{
    margin0;
    padding0;
    font-weightnormal;
}
ul,li{
    list-stylenone;
}
p{
    margin0;
    padding0;
}


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

3回答
好帮手慕星星 2019-08-06 13:45:24

在火狐浏览器中测试目前第二屏就是显示完成的状态:

http://img1.sycdn.imooc.com//climg/5d4912dd000179ca06430310.jpg

没有动画的过程。如果添加上js之后(按照视频中添加),就会有不透明到透明的过程,这是因为在js中是文档加载完成之后,通过for循环添加的初始化动画:

http://img1.sycdn.imooc.com//climg/5d4913930001e44304590324.jpg

这样就会有一个显示到隐藏的过程,页面滚动的时候就会有隐藏到显示的过程。如果不想要前面的过程,可以和第一屏一样,在标签中添加上init类,这样直接就是隐藏的,页面滚动的时候再显示。

自己可以测试下。

  • 提问者 Perfect雪儿 #1
    老师,我滚动了,也是下了个火狐浏览器,但是元素没有出来
    2019-08-06 14:52:28
  • 好帮手慕星星 回复 提问者 Perfect雪儿 #2
    建议将修改后的HTML和js代码全部粘贴上来,老师帮助你测试下。
    2019-08-06 15:43:22
  • 提问者 Perfect雪儿 回复 好帮手慕星星 #3
    代码太多了粘贴不了,有没有其他方式联系你呢
    2019-08-06 17:41:15
好帮手慕星星 2019-08-06 10:40:36

你好,没有动画是正常的,因为在宣传页项目源码中,老师在js中封装了动画完成的方法,第一屏动画是在定时器中调用的,如下:

http://img1.sycdn.imooc.com//climg/5d48e8230001160a10390350.jpg

页面打开100毫秒之后调用方法,执行动画。

而第二屏以及以下的动画是在滚动事件中执行的。如果忘记了是怎么写的,可以再回顾下视频或者看一下项目源码哦:

http://img1.sycdn.imooc.com//climg/5d48e89d00010a9712500615.jpg

祝学习愉快!

  • 提问者 Perfect雪儿 #1
    好的知道了,想老师帮忙看下,为什么第二屏中效果是文字从上往下,而且是由不透明变为透明,和写的代码相反
    2019-08-06 10:56:16
好帮手慕星星 2019-08-06 10:17:02

同学你好,代码没有问题。

是因为animate.css动画中过渡用了all的原因:

http://img1.sycdn.imooc.com//climg/5d48e2d700019f8804600481.jpg

Chrome浏览器会计算到所有属性,所以使用all会有问题。建议使用火狐浏览器进行测试,看看效果是否正确。

祝学习愉快!

  • 提问者 Perfect雪儿 #1
    老师,刚试了下,火狐的话第一屏的元素都不见了,而且第一屏和第二屏没有任何动画,该怎么修改呢?
    2019-08-06 10:26:19
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师
插入代码