-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
431 lines (398 loc) · 18.7 KB
/
index.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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html class="ie ie6 ie-lt10 ie-lt9 ie-lt8 ie-lt7 no-js" lang="en"> <![endif]-->
<!--[if IE 7 ]> <html class="ie ie7 ie-lt10 ie-lt9 ie-lt8 no-js" lang="en"> <![endif]-->
<!--[if IE 8 ]> <html class="ie ie8 ie-lt10 ie-lt9 no-js" lang="en"> <![endif]-->
<!--[if IE 9 ]> <html class="ie ie9 ie-lt10 no-js" lang="en"> <![endif]-->
<!--[if gt IE 9]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->
<!-- the "no-js" class is for Modernizr. -->
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery differential scroll plugin | By Tim Bakkum</title>
<meta name="description"
content="A responsive jQuery plugin for applying a parallax-like scrolling effect to a two column layout" />
<link rel="stylesheet" href="bower_components/flat-ui/dist/css/vendor/bootstrap.min.css">
<link rel="stylesheet" href="bower_components/flat-ui/dist/css/flat-ui.css">
<style>
/* to-do : to refactor in plugin css file */
.differential-scroll-container {
position: relative;
overflow: hidden;
}
@media screen and (min-width: 40em) {
/* .differential-scroll-column{
float:left;
width:50%;
} */
}
img {
width: 100%;
height: auto;
}
.yellow-wrapper {
background: #fae62d;
}
.purple-wrapper {
background: #66f;
}
.black-purple-wrapper {
background: #34495e;
}
.navbar {
margin-bottom: 0;
}
footer {
background: #34495e;
}
.btn-success {
background: #7fffd4;
color: #34495e;
transition: all .3s ease;
}
.btn-success:hover,
.btn-success:focus {
background: #00ffff;
color: #34495e;
}
</style>
</head>
<body>
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date(); a = s.createElement(o),
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-73141448-1', 'auto');
ga('send', 'pageview');
</script>
<div class="yellow-wrapper" id="top">
<header class="container">
<div class="row">
<div class="col-xs-12">
<h1>jQuery Differential Scroll Plugin</h1>
<p>A simple, lightweight, two column differential scroll plugin<br><small>
Created by <a href="http://timbakkum.net">Tim Bakkum</a>
</small></p>
<p style="margin-bottom: 30px;">
<a aria-label="Follow @timbakkum on GitHub" data-count-aria-label="# followers on GitHub"
data-count-api="/users/timbakkum#followers" data-count-href="/timbakkum/followers" data-style="mega"
href="https://github.com/timbakkum" class="github-button">Follow @timbakkum</a>
<a aria-label="Issue timbakkum/jquery-differential-scroll on GitHub"
data-count-aria-label="# issues on GitHub"
data-count-api="/repos/timbakkum/jquery-differential-scroll#open_issues_count" data-style="mega"
data-icon="octicon-issue-opened" href="https://github.com/timbakkum/jquery-differential-scroll/issues"
class="github-button">Issue</a>
<a aria-label="Download timbakkum/jquery-differential-scroll on GitHub" data-style="mega"
data-icon="octicon-cloud-download"
href="https://github.com/timbakkum/jquery-differential-scroll/archive/master.zip"
class="github-button">Download</a>
</p>
</div>
</div>
</header>
</div>
<main class="container">
<div class="row">
<article class="col-xs-12">
<h2>About</h2>
<p>
Do you have unequal two column layouts? Do you have multiple of them per page? This plugin is for you!
</p>
<p>
Say you have a lot of images in one column and few description text in an adjacent column. The user will lose
valuable information once he/she has scrolled past the bottom of the column.
</p>
<p>
This plugin allows you to fix the smallest column to the viewport so the user can easily reference related
information, for which they otherwise had to scroll back up.
</p>
<p>
The behaviour is comparable to a parallax effect.
</p>
<h3>
Plugin behaviour
</h3>
<p>
<ul>
<li>The plugin will only apply the functionality if there are <em>exactly</em> 2 columns.</li>
<li>The columns must not have equal heights (if so, no point in activating.. ).</li>
<li>The tallest column should be larger than the screen height. If not, there is no point in initializing
behaviour as both column are completely visible in the viewport.</li>
<li>If the smallest column is smaller than the window height, it will only be blocked in the top of the
screen to avoid jumpy effets.</li>
</ul>
Please refer to the plugin documentation for options and methods.
</p>
<h3>
Getting started
</h3>
<h4>Requirements</h4>
<p>
This plugin requires jQuery 1.7+ to be active on the page.
</p>
<p>
This plugin uses <code>window.matchMedia()</code> which is unsupported in <a
href="http://caniuse.com/#feat=matchmedia">some browsers</a>. Please use a polyfill if you really need to.
</p>
<h4>Installation</h4>
<p>
Download the <a
href="https://raw.github.com/timbakkum/jquery-differential-scroll/master/dist/differential-scroll.min.js">production
version</a> or the <a
href="https://raw.github.com/timbakkum/jquery-differential-scroll/master/dist/differential-scroll.js">development
version</a>.
</p>
<p>
In your web page:
<pre><code><script src="jquery.js"></script>
<script src="dist/differential-scroll.min.js"></script>
<script>
jQuery(function($) {
$('.differential-scroll-container').differentialScroll({});
});
</script></code></pre>
</p>
<h4>Markup</h4>
<pre><code>
<div class="differential-scroll-container">
<div class="differential-scroll-column">
your favorite content
</div>
<div class="differential-scroll-column">
Some more of your favorite content
</div>
</div></code></pre>
<h4>
Styling
</h4>
<p>
The plugin doesn't provide the intial styling of the columns. Please provide proper column styling in your
stylesheet. I recommend using a responsive CSS grid framework like Bootstrap or Foundation to rapidly create
and manage your columns across different mediaqueries. You can also copy the following css into your
stylesheet to create a 50/50 width column layout.
</p>
<pre><code>.differential-scroll-container{
position: relative;
overflow: hidden;
}
.differential-scroll-column{
width:50%;
float:left;
}</code></pre>
<hr>
<h3>Options</h3>
<p>
Under construction ..
</p>
<h4>breakpoint</h4>
<p>String, defaults to <code>"(min-width:40em)"</code>. Will be used in
<code>window.matchMedia(breakpoint)</code>. Point at which behaviour is toggle on/off.</p>
<h4>offsetTop</h4>
<p>Integer, defaults to <code>0</code>. Used to add extra top offsetting in case of a sticky menu for example.
<br><strong>Feature under development</strong></p>
<h4>offsetBottom</h4>
<p><strong>Feature under consideration</strong></p>
<h4>columnClass</h4>
<p>String, to set a different column class than <code>.differential-scroll-column</code> <br><strong>Feature
under consideration</strong></p>
<h3>Methods</h3>
<p>
Under construction ..
</p>
<hr>
<h3>Known bugs</h3>
<p>
coming soon
</p>
<p>
Plugin has jumpy behaviour on IE and Safari due to their implentation of scroll. It appears that the rendering
of changes made by javascript on scroll are applied after the scroll action is finished. Currently
investigating..
</p>
<hr>
<h3>Demonstration</h3>
<p>
Please scroll down below to see multiple instances of the plugin in action. The breakpoint for toggling
behaviour on/off has been defined at 640px.
</p>
</article>
</div>
</main>
<div class="yellow-wrapper">
<section class="container">
<div class="row">
<div class="differential-scroll-container" style="">
<div class="differential-scroll-column col-xs-12 col-sm-6" style="padding:20px;">
<h5>First example</h5>
<div>Tempore corporis culpa quod hic voluptate debitis, facere modi id dignissimos dolor reprehenderit enim
accusantium delectus cumque, soluta alias in amet repellat harum maxime! Quis voluptates cupiditate
dolores beatae debitis.</div>
<div>Optio corporis ducimus aut, impedit eaque maxime qui, obcaecati nam saepe ipsa alias officia tempore
veritatis minima unde fuga quae rem ad repudiandae aspernatur iure, provident vero voluptates dolores,
libero!</div>
<div>Quos sequi recusandae at voluptatem rem maiores natus fuga, ipsa, molestiae eos, tenetur pariatur quas
cum non. Reiciendis necessitatibus, explicabo sunt sapiente a minus hic quisquam, quod molestiae,
praesentium accusamus.</div>
<div>Necessitatibus nemo, repudiandae illum voluptatem! Eligendi, ea libero delectus aut quaerat ipsam
inventore quod praesentium, soluta quis labore porro autem vitae iste dolore aperiam saepe. Aperiam
deleniti quasi eligendi consequuntur.</div>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repellat rem laboriosam, necessitatibus. Ab ea
aspernatur, libero atque eveniet impedit laudantium eligendi nobis maxime itaque dolor molestias nulla fugit
distinctio est nihil iusto. Repudiandae unde neque accusantium perspiciatis minus, aut ipsa quam enim
aspernatur rerum repellendus non, alias, commodi animi mollitia.
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Pariatur blanditiis omnis deleniti, quaerat
eos, est maxime assumenda vitae fugiat quia fuga consectetur amet quis, aperiam?</p>
</div>
<div class="differential-scroll-column col-xs-12 col-sm-6" style="padding:20px;">
<img class="img-rounded img-responsive" src="https://picsum.photos/400/300" alt="">
<p class="img-comment"><strong>Note:</strong> placeholder image courtesy of https://picsum.photos/</p>
<img class="img-rounded img-responsive" src="https://picsum.photos/400/300" alt="">
<p class="img-comment"><strong>Note:</strong> placeholder image courtesy of https://picsum.photos/</p>
<img class="img-rounded img-responsive" src="https://picsum.photos/400/300" alt="">
<p class="img-comment"><strong>Note:</strong> placeholder image courtesy of https://picsum.photos/</p>
<img class="img-rounded img-responsive" src="https://picsum.photos/400/300" alt="">
<p class="img-comment"><strong>Note:</strong> placeholder image courtesy of https://picsum.photos/</p>
<img class="img-rounded img-responsive" src="https://picsum.photos/400/300" alt="">
<p class="img-comment"><strong>Note:</strong> placeholder image courtesy of https://picsum.photos/</p>
<img class="img-rounded img-responsive" src="https://picsum.photos/400/300" alt="">
<p class="img-comment"><strong>Note:</strong> placeholder image courtesy of https://picsum.photos/</p>
<img class="img-rounded img-responsive" src="https://picsum.photos/400/300" alt="">
<p class="img-comment"><strong>Note:</strong> placeholder image courtesy of https://picsum.photos/</p>
<img class="img-rounded img-responsive" src="https://picsum.photos/400/300" alt="">
<p class="img-comment"><strong>Note:</strong> placeholder image courtesy of https://picsum.photos/</p>
</div>
</div>
</div>
</section>
</div>
<div class="purple-wrapper" style="width:100%;">
<aside class="container">
<div class="row">
<div class="col-xs-12 col-sm-8 col-sm-offset-2">
<h2 class="text-center" style="color:white;">Help me improve this project! Contribute on GitHub</h2>
<p class="text-center" style="margin-bottom: 30px;">
<a href="https://github.com/timbakkum/jquery-differential-scroll" target="blank"
class="btn btn-lg btn-success">jQuery differential scrolling plugin on GitHub</a>
</p>
</div>
</div>
</aside>
</div>
<div class="yellow-wrapper">
<div class="container">
<div class="row">
<div class="differential-scroll-container">
<div class="differential-scroll-column col-xs-12 col-sm-4" style=" padding:20px;">
<h5>Second example</h5>
<p>This example has columns with different widths</p>
<hr>
<div>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt reiciendis mollitia voluptate?
Similique, pariatur sequi doloribus, quia rem nulla esse, animi omnis perferendis tenetur fugit inventore
itaque temporibus magni adipisci.</div>
<div>Tempore corporis culpa quod hic voluptate debitis, facere modi id dignissimos dolor reprehenderit enim
accusantium delectus cumque, soluta alias in amet repellat harum maxime! Quis voluptates cupiditate
dolores beatae debitis.</div>
<div>Optio corporis ducimus aut, impedit eaque maxime qui, obcaecati nam saepe ipsa alias officia tempore
veritatis minima unde fuga quae rem ad repudiandae aspernatur iure, provident vero voluptates dolores,
libero!</div>
<div>Quos sequi recusandae at voluptatem rem maiores natus fuga, ipsa, molestiae eos, tenetur pariatur quas
cum non. Reiciendis necessitatibus, explicabo sunt sapiente a minus hic quisquam, quod molestiae,
praesentium accusamus.</div>
<div>Necessitatibus nemo, repudiandae illum voluptatem! Eligendi, ea libero delectus aut quaerat ipsam
inventore quod praesentium, soluta quis labore porro autem vitae iste dolore aperiam saepe. Aperiam
deleniti quasi eligendi consequuntur.</div>
<img class="img-rounded img-responsive" src="http://placekitten.com/g/800/600" alt="">
<p class="img-comment"><strong>Note:</strong> placeholder image courtesy of placekitten.com</p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repellat rem laboriosam, necessitatibus. Ab ea
aspernatur, libero atque eveniet impedit laudantium eligendi nobis maxime itaque dolor molestias nulla fugit
distinctio est nihil iusto. Repudiandae unde neque accusantium perspiciatis minus, aut ipsa quam enim
aspernatur rerum repellendus non, alias, commodi animi mollitia.
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Pariatur blanditiis omnis deleniti, quaerat
eos, est maxime assumenda vitae fugiat quia fuga consectetur amet quis, aperiam?</p>
<img class="img-rounded img-responsive" src="http://placekitten.com/g/800/600" alt="">
<p class="img-comment">
<strong>Note:</strong> placeholder image courtesy of placekitten.com</p>
<img class="img-rounded img-responsive" src="http://placekitten.com/g/800/600" alt="">
<p class="img-comment">
<strong>Note:</strong> placeholder image courtesy of placekitten.com</p>
</div>
<div class="differential-scroll-column col-sm-8" style="padding:20px;">
<img class="img-rounded img-responsive" src="http://placekitten.com/g/500/300" alt="">
<p class="img-comment">
<strong>Note:</strong> placeholder image courtesy of placekitten.com</p>
<img class="img-rounded img-responsive" src="http://placekitten.com/g/800/600" alt="">
<p class="img-comment">
<strong>Note:</strong> placeholder image courtesy of placekitten.com</p>
<img class="img-rounded img-responsive" src="http://placekitten.com/g/600/300" alt="">
<p class="img-comment">
<strong>Note:</strong> placeholder image courtesy of placekitten.com</p>
<img class="img-rounded img-responsive" src="http://placekitten.com/g/600/300" alt="">
<p class="img-comment">
<strong>Note:</strong> placeholder image courtesy of placekitten.com</p>
<img class="img-rounded img-responsive" src="http://placekitten.com/g/600/300" alt="">
<p class="img-comment">
<strong>Note:</strong> placeholder image courtesy of placekitten.com</p>
<img class="img-rounded img-responsive" src="http://placekitten.com/g/800/600" alt="">
<p class="img-comment">
<strong>Note:</strong> placeholder image courtesy of placekitten.com</p>
<img class="img-rounded img-responsive" src="http://placekitten.com/g/800/600" alt="">
<p class="img-comment">
<strong>Note:</strong> placeholder image courtesy of placekitten.com</p>
<img class="img-rounded img-responsive" src="http://placekitten.com/g/800/600" alt="">
<p class="img-comment">
<strong>Note:</strong> placeholder image courtesy of placekitten.com</p>
<img class="img-rounded img-responsive" src="http://placekitten.com/g/800/600" alt="">
<p class="img-comment">
<strong>Note:</strong> placeholder image courtesy of placekitten.com</p>
<img class="img-rounded img-responsive" src="http://placekitten.com/g/800/600" alt="">
<p class="img-comment">
<strong>Note:</strong> placeholder image courtesy of placekitten.com</p><img
class="img-rounded img-responsive" src="http://placekitten.com/g/800/600" alt="">
<p class="img-comment">
<strong>Note:</strong> placeholder image courtesy of placekitten.com</p>
</div>
</div>
</div>
</div>
</div>
<div class="black-purple-wrapper">
<footer class="container">
<div class="row">
<div class="col-xs-12">
<nav class="navbar navbar-inverse navbar-embossed" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse-01">
<span class="sr-only">Toggle navigation</span>
</button>
<a class="navbar-brand" href="#top">jQuery Differential Scroll Plugin</a>
</div>
<div class="collapse navbar-collapse" id="navbar-collapse-01">
<ul class="nav navbar-nav navbar-left">
<li><a href="http://timbakkum.net" target="_blank">Tim Bakkum, multilingual web developer and
translator</a></li>
<li><a href="https://github.com/timbakkum/jquery-differential-scroll" target="_blank">Project on
GitHub</a></li>
<li><a href="">Licence</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</nav>
</div>
</div>
</footer>
</div>
<script src="bower_components/jquery/dist/jquery.min.js" type="text/javascript"></script>
<script src="src/jquery.differential-scroll.js" type="text/javascript"></script>
<script>
$(document).ready(function () {
var ds = $('.differential-scroll-container').differentialScroll();
});
</script>
<!-- Place this tag right after the last button or just before your close body tag. -->
<script async defer id="github-bjs" src="https://buttons.github.io/buttons.js"></script>
</body>
</html>