Skip to content

Commit 5e29770

Browse files
committed
add a part of main module
2 parents 1c10cea + 04d11e2 commit 5e29770

6 files changed

Lines changed: 146 additions & 129 deletions

File tree

‎README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# HashCoding
1+
# HashCoding
22

33
[百度前端技术学院](http://ife.baidu.com) 热身训练作品
44

55
点击[这里](http://hashcoding.github.io)进入
66

77
## 约定
88

9-
* 各自完成组件,并且在组件下的 `example` 文件夹下完成测试
10-
* 组件完成后在填充到 `index.html` 完成测试
11-
* 大家一起 `review`
9+
* 各自完成组件,本地测试完成后,将组件目录置于components下
10+
* 组件完成且测试成功后,把HTML代码填充到 `index.html` ,并引入相应的css和js文件
11+
* 大家一起 `review`,一切顺利的话,合并打包发布
1212

1313
## ToDo
1414

Lines changed: 61 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,85 @@
1+
* {
2+
margin: 0;
3+
padding: 0;
4+
}
5+
6+
html,body{
7+
font-family: "Microsoft Yahei";
8+
font-size: 18px;
9+
height: 100%;
10+
}
11+
112
@font-face {font-family: 'iconfont';
213
src: url('iconfont/iconfont.eot'); /* IE9*/
314
src: url('iconfont/iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
415
url('iconfont/iconfont.woff') format('woff'), /* chrome、firefox */
516
url('iconfont/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
617
url('iconfont/iconfont.svg#iconfont') format('svg'); /* iOS 4.1- */
718
}
8-
.container {
9-
position: relative;;
10-
height: 100%;
19+
20+
#first_screen {
21+
height: 100%;
22+
width: 100%;
23+
background-color: #009999;
1124
}
12-
section.firstscreen {
13-
height: 100%;
14-
background-color: rgb(27, 188, 155);
15-
overflow: hidden;
25+
26+
#svg_logo {
27+
width:600px;
28+
height: 400px;
29+
background-color: #009999;
30+
31+
margin: 0 auto 0 auto;
32+
1633
position: relative;
17-
padding: 0 10px;
34+
top: 25%;
35+
36+
1837
}
19-
.firstscreen path {
38+
39+
svg path {
2040
stroke-dasharray: 2000;
2141
stroke-dashoffset: 2100;
22-
-webkit-animation: dash 4.3s linear forwards;
23-
-moz-animation: dash 4.3s linear forwards;
2442
animation: dash 4.3s linear forwards;
43+
-webkit-animation:dash 4.3s linear forwards;
2544
}
26-
.firstscreen .main-team-ife {
27-
position: absolute;
28-
top: 8%;
29-
left: 10%;
45+
46+
#first_screen p {
47+
width: 800px;
48+
height: 50px;
49+
color:white;
50+
text-align: center;
51+
font-size: 1.5rem;
52+
53+
margin: -80px auto 0 auto;
54+
55+
position: relative;
56+
top: 25%;
3057
}
31-
.firstscreen .main-team-name {
32-
height: 400px;
33-
position: relative;
34-
top: 44%;
35-
margin-top: -200px;
3658

59+
#ife_logo {
60+
position: absolute;
61+
top: 10%;
62+
left: 10%;
3763
}
38-
.firstscreen .main-team-word {
39-
font-size: 25px;
40-
line-height: 1.5;
41-
color: #FFFFFF;
64+
65+
#arow_down {
66+
width:100px;
4267
text-align: center;
43-
position: relative;
44-
top:40%;
4568

46-
}
69+
/*以下代码实现.arow_down的绝对定位下的水平居中*/
70+
margin: 0 auto;
4771

48-
.firstscreen #arow_down {
49-
width:100px;
50-
text-align: center;
51-
/*以下代码实现.arow_down的绝对定位下的水平居中*/
52-
margin: 0 auto;
53-
position:absolute;
54-
bottom: 30px;
55-
left: 0;
56-
right: 0;
72+
position:absolute;
73+
bottom: 30px;
74+
left: 0;
75+
right: 0;
5776
}
5877

59-
.firstscreen #arow_down a {
60-
text-decoration: none;
78+
#arow_down a {
79+
text-decoration: none;
6180
}
6281

63-
.firstscreen .down{
82+
.xiangxia{
6483
font-family:"iconfont" !important;
6584
font-size:25px;
6685
font-style:normal;
@@ -69,24 +88,12 @@ section.firstscreen {
6988
-webkit-text-stroke-width: 0.2px;
7089
-moz-osx-font-smoothing: grayscale;
7190
}
72-
.firstscreen .down:hover {
73-
cursor: pointer;
74-
}
7591

76-
/* animation hhere */
92+
93+
/* animation here */
7794

7895
@keyframes dash {
7996
to {
8097
stroke-dashoffset: 0;
8198
}
82-
}
83-
@-webkit-keyframes dash {
84-
to {
85-
stroke-dashoffset: 0;
86-
}
87-
}
88-
@-moz-keyframes dash {
89-
to {
90-
stroke-dashoffset: 0;
91-
}
92-
}
99+
}
Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,42 @@
1-
(function(et) {
2-
addLoadListener(_firstscreen);
1+
var EventUtil = {
32

4-
function _firstscreen() {
5-
var arow = document.getElementById("arow_down"),
6-
h = document.documentElement.clientHeight;
3+
//添加事件
4+
addHandler:function (element,type,handler) {
5+
if (element.addEventListener) {
6+
element.addEventListener(type,handler,false);
7+
} else if (element.attachEvent) {
8+
element.attachEvent("on" + type,handler);
9+
} else {
10+
element["on"+type] = handler;
11+
}
12+
},
713

8-
et.addHandler(arow,"click",function(){
9-
console.log(111)
10-
var timerId = setInterval(function() {
11-
window.scrollBy(0,20);
12-
if (document.body.scrollTop > h) {
13-
clearInterval(timerId);
14-
};
15-
},5)
16-
});
17-
};
14+
//移除事件
15+
removeHandler:function (element,type,handler) {
16+
if (element.removeEventHandler) {
17+
element.removeEventHandler(type,handler,false);
18+
} else if (element.detachEvent) {
19+
element.detachEvent("on" + type,handler);
20+
} else {
21+
element["on" + type] = null;
22+
}
23+
}
24+
};
25+
26+
27+
(function() {
28+
var arow = document.getElementById("arow_down");
29+
30+
//为向下箭头绑定事件
31+
EventUtil.addHandler(arow,"click",function(){
32+
var h = document.documentElement.clientHeight; //获取页面视区高宽,用document.documentElement.clientHeight而不用window.innerHeight是为了兼容大部分浏览器
33+
timerId = setInterval(function() {
34+
window.scrollBy(0,20);
35+
if (document.body.scrollTop > h) {
36+
clearInterval(timerId);
37+
};
38+
},5)
39+
});
40+
})();
1841

19-
})(EventUtil);
2042

‎components/footer/footer.css‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
section.footer {
1+
.footer {
22
background-color: #2a2a2a;
33
height: 140px;
44
line-height: 140px;
55
}
66

7-
section.footer p {
7+
.footer p {
88
text-align: center;
99
color: #cccccc;
1010
}
1111

12-
section.footer p a:hover {
12+
.footer p a:hover {
1313
color: #ccc;
1414
}

‎components/main/main.css‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
/* section intro start */
2-
section.intro {
1+
/* main start */
2+
.main {
33
height: 100%;
44
}
5-
.section .section-title {
5+
.main .main-title {
66
color: #FFFFFF;
77
font-weight: 100;
88
font-size: 30px;
99
line-height: 2;
1010
text-align: center;
1111
}
12-
.intro {
12+
.main {
1313
background-color: #38A6F1;
1414
}
15-
.intro .intro-main {
15+
.main .main-intro {
1616
width: 1000px;
1717
margin: 10px auto 0;
1818
}
19-
.intro .member-header-list {
19+
.main .member-header-list {
2020
display: flex;
2121
-webkit-display: flex;
2222
}
@@ -36,7 +36,7 @@ section.intro {
3636
background: #FFFFFF
3737
}
3838

39-
.intro .member-content-list {
39+
.main .member-content-list {
4040
position: relative;
4141
height: 360px;
4242
margin: 35px auto 0;
@@ -50,5 +50,5 @@ section.intro {
5050
background: #FFFFFF;
5151
border-radius: 10px;
5252
}
53-
/* section intro end */
53+
/* main end */
5454

‎index.html‎

Lines changed: 32 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
<!DOCTYPE html>
2-
<html lang="en">
1+
<!DOCTYPE HTML>
2+
<html lang="en-US">
33
<head>
44
<meta charset="UTF-8">
5-
<meta name="author" content="summer">
6-
<link rel="stylesheet" href="./components/reset/reset.css">
7-
<link rel="stylesheet" href="./components/firstscreen/firstscreen.css">
5+
<title>HashCoding——2016百度前端学院</title>
86
<link rel="stylesheet" href="./components/main/main.css">
9-
<link rel="stylesheet" href="./components/scroll/scroll.css">
10-
<link rel="stylesheet" href="./components/footer/footer.css">
11-
<title>HashCoding--百度IFE</title>
7+
<link rel="stylesheet" href="components/reset/reset.css">
8+
<link rel="stylesheet" href="components/firstscreen/firstscreen.css">
9+
<link rel="stylesheet" href="components/footer/footer.css">
1210
</head>
1311
<body>
14-
<div class="container">
15-
<section class="section firstscreen">
16-
<div class="main-team-ife">
17-
<img src="./components/logo/ife-logo.png" alt="">
18-
</div>
19-
<div class="main-team-name">
20-
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" x="0px" y="0px" width="100%" height="400px" viewBox="-82.188 -95.86 800 400" enable-background="new -82.188 -95.86 800 300" xml:space="preserve">
12+
<div id="first_screen">
13+
<div id="ife_logo">
14+
<a href="http://ife.baidu.com/">
15+
<img src="components/logo/ife-logo.png" alt="百度前端学院">
16+
</a>
17+
</div>
18+
<div id="svg_logo">
19+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" x="0px" y="0px" width="100%" height="400px" viewBox="-82.188 -95.86 800 400" enable-background="new -82.188 -95.86 800 300" xml:space="preserve">
2120
<path fill="none" stroke="#FFFFFF" stroke-width="4" stroke-miterlimit="10" d="M10.174,75.437c0.36-0.12,0.6-0.48,0.72-0.721
2221
l9.84-56.157l-6.479-0.36c0.6-3.479,1.2-6.84,1.8-10.199c4.8,0,11.879,0,17.159,0c5.76,0,12.12,0,16.799,0
2322
c-0.48,3.359-1.2,6.72-1.92,10.199l-7.2,0.36c-0.36,0-0.48,0.24-0.48,0.6l-3.6,20.879c-0.12,0.36,0.24,0.48,0.48,0.48l25.199,0.12
@@ -95,16 +94,17 @@
9594
"/>
9695
</svg>
9796
</div>
98-
<p class="main-team-word">
99-
<i>Established By 5 Front-End Web Developers</i>
100-
</p>
101-
<div id="arow_down">
102-
<i class="down">&#xe682;</i>
103-
</div>
104-
</section>
105-
<section class="section intro">
106-
<h3 class="section-title">团队成员</h3>
107-
<div class="intro-main">
97+
<p id="slogan">Established by 5 Web Front-End Developers.</p>
98+
<div id="scroll_down">
99+
100+
</div>
101+
<div id="arow_down">
102+
<i class="xiangxia">&#xe682;</i>
103+
</div>
104+
</div>
105+
<div class="main section">
106+
<h3 class="main-title">团队成员</h3>
107+
<div class="main-intro">
108108
<ul class="member-header-list">
109109
<li class="mhl-item"><a href="#"></a></li>
110110
<li class="mhl-item"><a href="#"></a></li>
@@ -113,30 +113,18 @@ <h3 class="section-title">团队成员</h3>
113113
<li class="mhl-item"><a href="#"></a></li>
114114
</ul>
115115
<ul class="member-content-list">
116-
<li class="mcl-item">
117-
</li>
116+
<li class="mcl-item"></li>
118117
<li class="mcl-item"></li>
119118
<li class="mcl-item"></li>
120119
<li class="mcl-item"></li>
121120
<li class="mcl-item"></li>
122121
</ul>
123122
</div>
124-
</section>
125-
126-
<section class="section scroll" id="scroll">
127-
<img src="./components/scroll/scroll.png" alt="">
128-
</section>
129-
<section class="section footer">
130-
<p>
131-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
132-
</p>
133-
</section>
134-
</div>
135-
136-
<script src="./components/onload/onload.js"></script>
137-
<script src="./components/EventUtil/EventUtil.js"></script>
138-
<script src="./components/firstscreen/firstscreen.js"></script>
139-
<script src="./components/scroll/scroll.js"></script>
140-
123+
</div>
124+
<div class="footer">
125+
126+
</div>
127+
<script type="text/javascript" src="components/EventUtil/EventUtil.js"></script>
128+
<script type="text/javascript" src="components/firstscreen/firstscreen.js"></script>
141129
</body>
142130
</html>

0 commit comments

Comments
 (0)