Skip to content

Commit b2add45

Browse files
committed
fixed some bugs and rewrite index
1 parent 5ea8f07 commit b2add45

3 files changed

Lines changed: 131 additions & 201 deletions

File tree

Lines changed: 65 additions & 53 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,17 @@ section.firstscreen {
6988
-webkit-text-stroke-width: 0.2px;
7089
-moz-osx-font-smoothing: grayscale;
7190
}
72-
.firstscreen .down:hover {
73-
cursor: pointer;
91+
92+
93+
.main {
94+
width: 1000px;
95+
height: 2000px;
7496
}
7597

76-
/* animation hhere */
98+
/* animation here */
7799

78100
@keyframes dash {
79101
to {
80102
stroke-dashoffset: 0;
81103
}
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-
}
104+
}
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

‎index.html‎

Lines changed: 28 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
1-
<!DOCTYPE html>
2-
<html lang="en">
1+
<!DOCTYPE HTML>
2+
<html lang="en-US">
33
<head>
4-
<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">
8-
<link rel="stylesheet" href="./components/scroll/scroll.css">
9-
<link rel="stylesheet" href="./components/footer/footer.css">
10-
11-
12-
<title>HashCoding--百度IFE</title>
4+
<meta charset="UTF-8">
5+
<title>HashCoding——2016百度前端学院</title>
6+
<link rel="stylesheet" href="components/firstscreen/firstscreen.css">
137
</head>
148
<body>
15-
<div class="container">
16-
<section class="section firstscreen">
17-
<div class="main-team-ife">
18-
<img src="./components/logo/ife-logo.png" alt="">
19-
</div>
20-
<div class="main-team-name">
21-
<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">
9+
<div id="first_screen">
10+
<div id="ife_logo">
11+
<a href="http://ife.baidu.com/">
12+
<img src="components/logo/ife-logo.png" alt="百度前端学院">
13+
</a>
14+
</div>
15+
<div id="svg_logo">
16+
<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">
2217
<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
2318
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
2419
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,118 +90,19 @@
9590
c0-1.8-0.24-3.36-0.6-4.439c-0.6-1.68-1.92-2.52-3.959-2.52c-4.801,0-9,9.6-9,22.079C597.202,65.478,599.001,67.877,602.001,67.877z
9691
"/>
9792
</svg>
98-
</div>
99-
<p class="main-team-word">
100-
<i>Established By 5 Front-End Web Developers</i>
101-
</p>
102-
<div id="arow_down">
103-
<i class="down">&#xe682;</i>
104-
</div>
105-
</section>
106-
<p>
107-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
108-
</p>
109-
<p>
110-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
111-
</p>
112-
<p>
113-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
114-
</p>
115-
<p>
116-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
117-
</p>
118-
<p>
119-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
120-
</p>
121-
<p>
122-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
123-
</p>
124-
<p>
125-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
126-
</p>
127-
<p>
128-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
129-
</p>
130-
<p>
131-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
132-
</p>
133-
<p>
134-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
135-
</p>
136-
<p>
137-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
138-
</p>
139-
<p>
140-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
141-
</p>
142-
<p>
143-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
144-
</p>
145-
<p>
146-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
147-
</p>
148-
<p>
149-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
150-
</p>
151-
<p>
152-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
153-
</p>
154-
<p>
155-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
156-
</p>
157-
<p>
158-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
159-
</p>
160-
<p>
161-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
162-
</p>
163-
<p>
164-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
165-
</p>
166-
<p>
167-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
168-
</p>
169-
<p>
170-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
171-
</p>
172-
<p>
173-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
174-
</p>
175-
<p>
176-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
177-
</p>
178-
<p>
179-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
180-
</p>
181-
<p>
182-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
183-
</p>
184-
<p>
185-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
186-
</p>
187-
<p>
188-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
189-
</p>
190-
<p>
191-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
192-
</p>
193-
<p>
194-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
195-
</p>
196-
<section class="section scroll" id="scroll">
197-
<img src="./components/scroll/scroll.png" alt="">
198-
</section>
199-
<section class="section footer">
200-
<p>
201-
Copyright&nbsp;2016 by <a href="http://hashcoding.github.io/">HashCoding</a>
202-
</p>
203-
</section>
204-
</div>
205-
206-
<script src="./components/onload/onload.js"></script>
207-
<script src="./components/EventUtil/EventUtil.js"></script>
208-
<script src="./components/firstscreen/firstscreen.js"></script>
209-
<script src="./components/scroll/scroll.js"></script>
210-
93+
</div>
94+
<p id="slogan">Established by 5 Web Front-End Developers.</p>
95+
<div id="scroll_down">
96+
97+
</div>
98+
<div id="arow_down">
99+
<i class="xiangxia">&#xe682;</i>
100+
</div>
101+
</div>
102+
<div class="main">
103+
104+
</div>
105+
<script type="text/javascript" src="components/EventUtil/EventUtil.js"></script>
106+
<script type="text/javascript" src="components/firstscreen/firstscreen.js"></script>
211107
</body>
212-
</html>
108+
</html>

0 commit comments

Comments
 (0)