-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
69 lines (65 loc) · 1.38 KB
/
example.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>StickyNav</title>
<style>
body{color: #d4d4d4; text-align: center;}
header,
section,
footer
{
width: 1000px;
margin-left: auto;
margin-right: auto;
}
body > img
{
margin-left: auto;
margin-right: auto;
}
header,
footer
{
height:100px;
background: #333
}
section
{
background: #d4d4d4;
height: 1000px;
}
/* required */
.sticky
{
max-width: 1000px;
position: fixed;
width: 100%;
top: 0;
left: 0;
right: 0;
}
/* end required */
</style>
</head>
<body>
<img src="http://placehold.it/1000x300"alt="">
<header>
Stick this.
</header>
<section></section>
<footer></footer>
<script src="./node_modules/jquery/dist/jquery.min.js"></script>
<script src="./dist/StickyNav.min.js"></script>
<script>
$(window).on("load", function()
{
var _h = $("header").offset().top;
$("header").StickyNav(
{
stickAt: _h
});
});
</script>
</body>
</html>