-
-
Notifications
You must be signed in to change notification settings - Fork 140
/
new.html
188 lines (176 loc) · 5.03 KB
/
new.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
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<title>jQuery.panelSnap Plugin</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui">
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet">
<link href="./style.css" rel="stylesheet">
<script src="./panelSnap.js" defer></script>
<script src="./scripts.js" defer></script>
</head>
<body>
<section class="introduction">
<div class="center">
<h1>
PanelSnap
</h1>
<p>
A JavaScript plugin that, after scrolling, snaps to blocks of content which I like to call panels. You can actually nest
sets of panels as you will see throughout this demo page.
</p>
<p>
Each following panel will explain a specific feature of the panelSnap plugin.
</p>
<p>
<a href="https://github.com/guidobouman/jquery-panelsnap">https://github.com/guidobouman/jquery-panelsnap</a>
</p>
</div>
<div class="bottom">
Scroll down to see more.
</div>
</section>
<section class="basic_setup">
<h1>
Basic setup
</h1>
<pre><!doctype html>
<html>
<head>
<script src="/path/to/panelSnap.js" defer></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
new PanelSnap();
});
</script>
</head>
<body>
<section>
...
</section>
<section>
...
</section>
<section>
...
</section>
</body>
</html></pre>
</section>
<section class="configuration">
<h1>
Options
</h1>
<pre><script>
var defaultOptions = {
container: document.body,
panelSelector: '> section',
directionThreshold: 50,
delay: 0,
slideSpeed: 200,
easing: function(t) { return t },
};
new PanelSnap(options);
</script></pre>
</section>
<section class="options_explained">
<h1>Options explained</h1>
<dl class="explanation">
<dt>container</dt>
<dd>(element) The (scrolling) container that contains the panels.</dd>
<dt>panelSelector</dt>
<dd>(string) The css selector to find the panels. (scoped within the container).</dd>
<dt>directionThreshold</dt>
<dd>(interger) The amount of pixels required to scroll before the plugin detects a direction and snaps to the next panel.</dd>
<dt>delay</dt>
<dd>(integer) The amount of miliseconds the plugin pauzes before snapping to a panel.</dd>
<dt>slideSpeed</dt>
<dd>(integer) The amount of miliseconds in which the plugin snaps to the desired panel.</dd>
<dt>easing</dt>
<dd>(function) An easing function specificing the snapping motion.</dd>
</dl>
</section>
<section class="event_demo">
<h1>
Events
</h1>
<div class="group">
<div class="panels">
<section>
<h1>First</h1>
</section>
<section>
<h1>Second</h1>
</section>
<section>
<h1>Third</h1>
</section>
</div>
<div class="aside">
</div>
</div>
</section>
<section class="large_demo">
<h1>
Large panels
</h1>
<div class="group">
<div class="panels large">
<section>
<h1>First</h1>
</section>
<section>
<h1>Second</h1>
</section>
<section>
<h1>Third</h1>
</section>
</div>
<div class="aside">
<p>
When a panel is larger than the viewport, PanelSnap will snap to the top of a panel when scrolling down, and snap to it's
bottom when scrolling up.
</p>
</div>
</div>
</section>
<section class="horizontal_demo">
<h1>
Horizontal snapping
</h1>
<div class="panels horizontal">
<section>
<h1>First</h1>
</section>
<section>
<h1>Second</h1>
</section>
<section>
<h1>Third</h1>
</section>
</div>
</section>
<section class="manual_demo">
<h1>
Manual snapping
</h1>
<div class="group">
<pre class="with-side">$('#mylink').on('click', function() {
$('.container').panelSnap('snapTo', 'next');
});
$('#mylink').on('click', function() {
var $target = $('.container > .panel_two');
$('.container').panelSnap('snapToPanel', $target);
});</pre>
<div class="aside">
<p>
The `snapTo` method allows for navigating through panels with the following commands: `next`, `prev`, `first` & `last`.
</p>
<p>
The direct `snapToPanel` method snaps to a given target panel. It accepts a jQuery element that's an actual panel.
</p>
</div>
</div>
</section>
</body>
</html>