-
Notifications
You must be signed in to change notification settings - Fork 3
/
demo.html
233 lines (221 loc) · 6 KB
/
demo.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
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover">
<title>Simple JS sticky Header</title>
<script>
document.documentElement.className='js '+(!document.createElementNS||!document.createElementNS('http://www.w3.org/2000/svg','svg').createSVGRect?'nosvg':'svg');
</script>
<style>
html {
font-size: 62.5%;
font-size: calc(1em * .625)
}
html,
body {height: 100%}
body{
margin: 0;
padding: 0;
background: #eee;
font: normal normal normal 100%/1 sans-serif;
scroll-behavior: smooth
}
.wrapper {
width: 100%;
min-height: 100%;
height: auto !important;
margin: 0 auto -120px
}
.push,
.footer {
float: left;
clear: both;
width: 100%;
height: 120px
}
.header, .footer {
background: #171717;
color: #fff;
font-size: 2em;
line-height: 1.833em
}
.header{
height: 4.23em;
-webkit-animation: all 1s ease-in-out;
animation: all 1s ease-in-out
}
.header-inner, .footer {
position: relative;
width: 100%;
text-align: center;
font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', 'HelveticaNeue', Helvetica, Arial, 'Lucida Grande', sans-serif;
font-weight: 300
}
.header-inner {padding: 1.2em 0}
.content {height: 1600px}
.txt-center {text-align: center}
.fixed {
position:fixed;
z-index: 3000;
top: 0;
left: 0;
width: 99%;
height: auto;
padding: .6em 0 .6em 1%;
background: #fff;
background: rgba(255, 255, 255, .8);
border-bottom: 1px solid #ddd;
text-align: left;
color: #333;
line-height: 1em;
font-size: smaller;
-webkit-shadow: 0px 3px 5px rgba(0, 0, 0, .4);
-moz-shadow: 0px 3px 5px rgba(0, 0, 0, .4);
-o-shadow: 0px 3px 5px rgba(0, 0, 0, .4);
box-shadow: 0px 3px 5px rgba(0, 0, 0, .4);
}
/* IE6 support can be removed if you don't need it */
* html .fixed {
position: absolute; left: 0px; top: 0px;
left: expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
top: expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
}
.fixed .header-inner {
padding: .7em 0 0 1em;
text-align: left;
color: #333
}
.content {font-size: 1.5em}
.scroll-down {
display: block;
position: relative;
top: 15em;
left: 50%;
width: 32px;
height: 32px;
margin: 0 0 0 -16px;
text-decoration: none
}
.svg .scroll-down {
border: 2px solid #424242;
border-radius: 50%;
-webkit-shadow: shadow: 0 1px 1px #fff;
-moz-shadow: shadow: 0 1px 1px #fff;
-o-shadow: shadow: 0 1px 1px #fff;
box-shadow: shadow: 0 1px 1px #fff;
-webkit-animation: bounce 2s infinite 2s;
animation: bounce 2s infinite 2s;
-webkit-transition: all .2s ease-in;
-o-transition: all .2s ease-in;
transition: all .2s ease-in
}
@-webkit-keyframes bounce {
0%,
100%,
20%,
50%,
80% {
-webkit-transform: translateY(0);
transform: translateY(0);
}
40% {
-webkit-transform: translateY(-10px);
transform: translateY(-10px);
}
60% {
-webkit-transform: translateY(-5px);
transform: translateY(-5px);
}
}
@keyframes bounce {
0%,
100%,
20%,
50%,
80% {
-webkit-transform: translateY(0);
transform: translateY(0);
}
40% {
-webkit-transform: translateY(-10px);
transform: translateY(-10px);
}
60% {
-webkit-transform: translateY(-5px);
transform: translateY(-5px);
}
}
.svg .scroll-down:after {
display: block;
content: '';
position: relative;
top: 6px;
bottom: 2px;
left: 50%;
width: 12px;
height: 11px;
margin: 0 0 0 -7px;
border: 2px solid #424242;
border-width: 0 0 2px 2px;
-webkit-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg)
}
.content span {
position: absolute;
top: -.3em;
width: 100%;
display: block;
text-align: center;
color: #aaa;
font-size: 3em
}
.svg .content span {display: none}
.content p {
padding: 0 .5em;
color: #aaa;
line-height: 20em;
text-shadow: 0 1px 1px #fff
}
.gotop {
display: table-cell;
display: inline-block;
position: absolute;
top: -2em;
right: 1em;
width: 3em;
height: 2em;
text-decoration: none;
color: #333;
font-size: smaller;
cursor: pointer
}
</style>
</head>
<body id="top">
<div class="wrapper">
<div class="header" id="header-outer">
<div class="header-inner" id="header">
Header
</div>
</div> <!-- /header -->
<div class="content">
<a href="#nogo" class="scroll-down"><span>↨</span></a>
<p class="txt-center">Please, scroll down</p>
</div>
<div class="push"></div>
</div> <!-- /wrapper -->
<div class="footer" id="nogo">
<a href="#top" title="Go Top" class="gotop">↑ Top</a>
<div class="footer-inner">
<p>Footer</p>
</div>
</div>
<script>
/*! Simple fixed nav by cara-tm.com - https://github.com/cara-tm/simple-sticky-header - MIT Licence. */
var fixednav=function(o){"use strict";var didScroll=!1,nav=document.getElementById(o.id),header=document.getElementById(o.outer);if("undefined"==typeof o.up)o.up=0;if("undefined"==typeof o.down)o.down=0;if("undefined"==typeof o.delay)o.delay=70;window.onscroll=doOnScroll;function doOnScroll(){didScroll=true;}setInterval(function(){if(didScroll){didScroll=0;var top=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop,height=(o.distance||header.clientHeight);if(top>height-o.down){addClass("fixed",nav);}else if(top<=height-o.up){nav.className=nav.className.replace(" fixed","");}}},o.delay);function addClass(a,s){var c=s.className;if(-1==c.indexOf(a)&&""!==c&&(a=" "+a))s.className=c+a;}};
// Loading with options:
fixednav({id: "header", outer: "header-outer", distance: 60, down: -20, up: 15, delay: 70});
</script>
</body></html>