-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
310 lines (261 loc) · 11.2 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
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Overflow Scroller</title>
<meta name="description" content="A simple CSS and javascript Package that handles previous/next arrows and scrolling. ">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/4.2.0/normalize.min.css">
<link href="https://fonts.googleapis.com/css?family=Lato:300,300i,700,700i" rel="stylesheet">
<link href="overflow-scroller.css" rel="stylesheet">
<style>
* {
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body {
font-family: 'Lato', sans-serif;
text-align: center;
color: #222;
font-size: 100%;
width: 100%;
overflow-x: hidden;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#fcfcfc+0,edeff2+100 */
background: rgb(252,252,252); /* Old browsers */
background: -moz-linear-gradient(top, rgba(252,252,252,1) 0%, rgba(237,239,242,1) 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, rgba(252,252,252,1) 0%,rgba(237,239,242,1) 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, rgba(252,252,252,1) 0%,rgba(237,239,242,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfcfc', endColorstr='#edeff2',GradientType=0 ); /* IE6-9 */
}
a {
color: #00aed1;
text-decoration: none;
}
a:hover {
color: #008faf;
text-decoration: underline;
}
h1,
h2,
h3,
h4,
h5 {
font-weight: 300;
text-transform: uppercase;
margin-top: 2em;
margin-bottom: .5em;
}
h1 {
font-weight: 300;
text-transform: uppercase;
font-size: 7vw;
padding-top: 3em;
margin-top: 0;
margin-bottom: 1em;
}
@media (min-width: 600px) {
h1 {
font-size: 3.6vw;
}
}
h3 {
font-size: 1.8em;
}
h4 {
font-size: 1.5em;
}
img {
max-width: 100%;
}
.image-item {
width: 50%;
padding: 10px;
}
@media (min-width: 600px) {
.image-item {
width: 33.33333%;
}
}
@media (min-width: 1024px) {
.image-item {
width: 25%;
}
}
@media (min-width: 1300px) {
.image-item {
width: 20%;
}
}
pre, code {
font-size: .92em;
}
pre {
background: #29393d;
color: #fff;
border-radius: 2px;
padding: 15px;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
.content {
padding: 4em 15px;
margin: 0 auto;
max-width: 600px;
line-height: 1.6em;
text-align: left;
}
@media (max-width: 600px) {
.github-ribbon {
display: none;
}
}
/*Carousel Scroller Custom Styles example */
.carousel-scroller {
padding: 0;
}
.carousel-item {
width: 100%;
}
.carousel-item img {
display: block;
}
</style>
<script src="modernizr-custom.js"></script>
</head>
<body>
<a href="https://github.com/zaneray/overflow-scroller" class="github-ribbon"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
<h1>Overflow Scroller</h1>
<h4>Carousel Example:</h4>
<section class="carousel-scroller overflow-scroller">
<div class="carousel-item">
<picture>
<source srcset="img/carousel-sample-1.jpg" media="(min-width: 768px)">
<img src="img/carousel-sample-1-mobile.jpg" alt="Cotopaxi at Sunset">
</picture>
</div>
<div class="carousel-item">
<picture>
<source srcset="img/carousel-sample-2.jpg" media="(min-width: 768px)">
<img src="img/carousel-sample-2-mobile.jpg" alt="Crisp Night on Lake MacDonald">
</picture>
</div>
<div class="carousel-item">
<picture>
<source srcset="img/carousel-sample-3.jpg" media="(min-width: 768px)">
<img src="img/carousel-sample-3-mobile.jpg" alt="Quito, Ecuador">
</picture>
</div>
</section>
<h4>Gallery Example:</h4>
<section class="overflow-scroller">
<div class="image-item">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c163.0.753.753/14726463_2149745985251456_3923220567812997120_n.jpg">
</div>
<div class="image-item">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/14482254_565260893669205_3496772556323553280_n.jpg">
</div>
<div class="image-item">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c143.0.794.794/14373996_313779565646086_22003315025903616_n.jpg">
</div>
<div class="image-item">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c191.0.698.698/14145328_295449170826699_497112261_n.jpg">
</div>
<div class="image-item">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c136.0.808.808/14073289_289619111410076_125881873_n.jpg">
</div>
<div class="image-item">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c135.0.810.810/14134949_173729363059445_1311565077_n.jpg">
</div>
<div class="image-item">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c110.0.859.859/14052382_1680209678968017_111863488_n.jpg">
</div>
<div class="image-item">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c127.0.826.826/13743534_283031258720594_90280931_n.jpg">
</div>
<div class="image-item">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c120.0.840.840/13741414_854585991340935_2005679092_n.jpg">
</div>
<div class="image-item">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/13696737_597514057094700_1307239881_n.jpg">
</div>
<div class="image-item">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c102.0.876.876/13827245_274002892980015_1364237770_n.jpg">
</div>
<div class="image-item">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c180.0.720.720/13707187_1826573950907165_472489455_n.jpg">
</div>
<div class="image-item">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c60.0.959.959/13649265_1597633853867949_1408115842_n.jpg">
</div>
</section>
<section class="content">
<p>Overflow Scroller is a simple package of CSS and javascript that harnesses the simple <code>overflow: auto</code> behavior allowing for swipeability at mobile and on touch enabled devices (trackpads, magic mouse). CSS Snap points optionally enhance it for Safari (Desktop &: mobile), Firefox, and IE/Edge users. Previous and next arrows are added that control the scrolling for non-touch and desktop users. </p>
<h3>dependencies</h3>
<p>You can download Overflow Scroller <a href="https://github.com/zaneray/overflow-scroller">here</a>. There are a couple dependencies, it will work fine without them but it provides a better experience & performance if they are added.</p>
<ul>
<li><strong><a href="https://modernizr.com/download/?-hiddenscroll-setclasses" target="_blank">Modernizr:</a></strong> Has browser feature detection for Hidden Scrollbars which is true for Mac OS and mobile OS. If 'hiddenscroll' is false (pc browser) the scrollbars will automatically be hidden.</li>
<li><strong><a href="http://benalman.com/projects/jquery-throttle-debounce-plugin/" target="_blank">Jquery Throttle Debounce:</a></strong> This adds the performace benefit of waiting until the scrolling is complete to show/hide the previous/next arrows. </li>
</ul>
<h3>Getting started</h3>
<p>Overflow scroller only requires a simple set of items in a div to get started, the use the css the containing div should have a class name of <code>overflow-scroller</code></p>
<h4>The Markup</h4>
<p>The HTML is pretty simple. A div with a collection of items that are ideally all the same height. </p>
<pre>
<div class="overflow-scroller">
<div class="child-item">...</div>
<div class="child-item">...</div>
<div class="child-item">...</div>
....
</div>
</pre>
<h4>The Script</h4>
<p>Overflow scroller is written as a jQuery plugin, there are a few options you can pass to it as well. </p>
<ul>
<li>
<strong>scrollPercentage: </strong> A number from 0-1 which dictates how far each click on a previous or next arrow scrolls the container.<br>
<em>Default: .9</em>
</li>
<li>
<strong>scrollSpeed: </strong> A number in milliseconds indicating how fast the container scrolls. <br>
<em>Default: 400</em>
</li>
<li>
<strong>snapPoints: </strong> Boolean to add or remove css snap-points which are partially supported, <a href="http://caniuse.com/#feat=css-snappoints">See here for current support</a>. CSS snap points properties can be customized in the CSS. <br>
<em>Default: true</em>
</li>
</ul>
<pre>
<script>
$('.overflow-scroller').overflowScroller();
//passing options
$('.overflow-scroller').overflowScroller({
scrollPercentage: .9,
scrollSpeed: 400,
snapPoints: false
});
</script>
</pre>
<h4>The Styles</h4>
<p>Feel free to overwrite the styles to your liking. There is a provided .less file and .css file. We use the less file to build the css file.</p>
<p><em><strong>Note:</strong> all child elements must have a width declared in CSS. The width can be a fixed pixel value or a % width of the container.</em></p>
<p> Before creating a pull request make sure to edit the .less file and then run:<code>lessc overflow-scroller.less overflow-scroller.css</code> </p>
</section>
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
<script src="overflow-scroller.js"></script>
<script>
$('.overflow-scroller').overflowScroller();
</script>
<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','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-86547929-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>