forked from denghao123/fixedScroll
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo3.html
83 lines (74 loc) · 2.05 KB
/
demo3.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
<title>fixedScroll demo3</title>
<link rel="stylesheet" href="style.css">
<style>
.h25 {
height: 25px;
}
.nav {
background-color: #fff;
}
.nav span {
padding: 2px 6px;
background-color: #999;
}
.nav .active {
background-color: #000;
color: #fff;
}
.demo {
overflow: hidden;
}
li {
margin-bottom: 20px;
height: 600px;
background-color: #efefef;
border: 1px solid #dbdbdb;
font-size: 100px;
color: #fff;
}
</style>
</head>
<body>
<div class="main">
<div class="usage">
<h3>使用方法:</h3>
<pre>
$(".nav").fixedScroll({
navEls: $(".nav-item"),
hookEls: $('.hook-item')
});
</pre>
</div>
<div class="demo">
<div class="h25">
<div class="nav">
<span class="nav-item">nav 1</span>
<span class="nav-item">nav 2</span>
<span class="nav-item">nav 3</span>
</div>
</div>
<ul class="hooks">
<li class="hook-item">1</li>
<li class="hook-item">2</li>
<li class="hook-item">3</li>
</ul>
</div>
<div class="foot"></div>
</div>
<script src="https://cdn.bootcss.com/jquery/1.10.1/jquery.min.js"></script>
<script src="fixedScroll.js"></script>
<script>
$(".nav").fixedScroll({
navEls: $(".nav-item"),
hookEls: $('.hook-item'),
hookOffset: 25
});
</script>
</body>
</html>