-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
143 lines (143 loc) · 4.22 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
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
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script type="text/javascript" src="https://raw.github.com/documentcloud/underscore/master/underscore.js"></script>
<script type="text/javascript" src="https://raw.github.com/documentcloud/backbone/master/backbone.js"></script>
<script type="text/javascript" src="https://raw.github.com/zynga/scroller/master/src/Animate.js"></script>
<script type="text/javascript" src="https://raw.github.com/zynga/scroller/master/src/Scroller.js"></script>
<script type="text/javascript" src="backbone.scrollable.js"></script>
<style>
.container {
position: relative;
height: 400px;
width: 300px;
overflow: hidden;
margin: 50px;
}
h2 {padding: 0; margin: 0}
ul {list-style: none}
li {display: block}
.sticky, .sticker {
height: 14px;
font-size: 13px;
font-weight: bold;
border-bottom: 1px solid #CCC;
background-color: #EEE;
}
.sticker {
position: absolute;
top: 0;
right: 0;
left: 0;
}
</style>
</head>
<body>
<div class="container">
<div class="body">
<div>
Some text can be here
</div>
<h2 class="sticky">Header 1</h2>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
</ul>
<h2 class="sticky">Header 2</h2>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
</ul>
<h2 class="sticky">Header 3</h2>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
</ul>
<h2 class="sticky">Header 4</h2>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
</ul>
<h2 class="sticky">Header 5</h2>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
</ul>
<h2 class="sticky">Header 6</h2>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
</ul>
<h2 class="sticky">Header 1</h2>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
</ul>
</div>
<div class="sticker"></div>
</div>
<script type="text/javascript">
$(function() {
var View = Backbone.ScrollableView.extend({
el: $('.container'),
bodyEl: $('.body').get(0) // can be assigned inside of the View (e.g. at the .render())
});
(new View({
stickable: true
})).initScroller();
});
</script>
</body>
</html>