jekyll-theme-ethereal 0.3.1 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Binary file
data/assets/js/main.js CHANGED
@@ -1,759 +1,759 @@
1
1
  /*
2
- Ethereal by HTML5 UP
3
- html5up.net | @ajlkn
4
- Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
2
+ Ethereal by HTML5 UP
3
+ html5up.net | @ajlkn
4
+ Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
5
5
  */
6
6
 
7
7
  (function($) {
8
8
 
9
- // Settings.
10
- var settings = {
9
+ // Settings.
10
+ var settings = {
11
11
 
12
- // Keyboard shortcuts.
13
- keyboardShortcuts: {
12
+ // Keyboard shortcuts.
13
+ keyboardShortcuts: {
14
14
 
15
- // If true, enables scrolling via keyboard shortcuts.
16
- enabled: true,
15
+ // If true, enables scrolling via keyboard shortcuts.
16
+ enabled: true,
17
17
 
18
- // Sets the distance to scroll when using the left/right arrow keys.
19
- distance: 50
18
+ // Sets the distance to scroll when using the left/right arrow keys.
19
+ distance: 50
20
20
 
21
- },
21
+ },
22
22
 
23
- // Scroll wheel.
24
- scrollWheel: {
23
+ // Scroll wheel.
24
+ scrollWheel: {
25
25
 
26
- // If true, enables scrolling via the scroll wheel.
27
- enabled: true,
26
+ // If true, enables scrolling via the scroll wheel.
27
+ enabled: true,
28
28
 
29
- // Sets the scroll wheel factor. (Ideally) a value between 0 and 1 (lower = slower scroll, higher = faster scroll).
30
- factor: 1
29
+ // Sets the scroll wheel factor. (Ideally) a value between 0 and 1 (lower = slower scroll, higher = faster scroll).
30
+ factor: 1
31
31
 
32
- },
32
+ },
33
33
 
34
- // Scroll zones.
35
- scrollZones: {
34
+ // Scroll zones.
35
+ scrollZones: {
36
36
 
37
- // If true, enables scrolling via scroll zones on the left/right edges of the scren.
38
- enabled: true,
37
+ // If true, enables scrolling via scroll zones on the left/right edges of the scren.
38
+ enabled: true,
39
39
 
40
- // Sets the speed at which the page scrolls when a scroll zone is active (higher = faster scroll, lower = slower scroll).
41
- speed: 15
40
+ // Sets the speed at which the page scrolls when a scroll zone is active (higher = faster scroll, lower = slower scroll).
41
+ speed: 15
42
42
 
43
- },
43
+ },
44
44
 
45
- // Dragging.
46
- dragging: {
45
+ // Dragging.
46
+ dragging: {
47
47
 
48
- // If true, enables scrolling by dragging the main wrapper with the mouse.
49
- enabled: true,
48
+ // If true, enables scrolling by dragging the main wrapper with the mouse.
49
+ enabled: true,
50
50
 
51
- // Sets the momentum factor. Must be a value between 0 and 1 (lower = less momentum, higher = more momentum, 0 = disable momentum scrolling).
52
- momentum: 0.875,
51
+ // Sets the momentum factor. Must be a value between 0 and 1 (lower = less momentum, higher = more momentum, 0 = disable momentum scrolling).
52
+ momentum: 0.875,
53
53
 
54
- // Sets the drag threshold (in pixels).
55
- threshold: 10
54
+ // Sets the drag threshold (in pixels).
55
+ threshold: 10
56
56
 
57
- },
57
+ },
58
58
 
59
- // If set to a valid selector , prevents key/mouse events from bubbling from these elements.
60
- excludeSelector: 'input:focus, select:focus, textarea:focus, audio, video, iframe',
59
+ // If set to a valid selector , prevents key/mouse events from bubbling from these elements.
60
+ excludeSelector: 'input:focus, select:focus, textarea:focus, audio, video, iframe',
61
61
 
62
- // Link scroll speed.
63
- linkScrollSpeed: 1000
62
+ // Link scroll speed.
63
+ linkScrollSpeed: 1000
64
64
 
65
- };
65
+ };
66
66
 
67
- // Vars.
68
- var $window = $(window),
69
- $document = $(document),
70
- $body = $('body'),
71
- $html = $('html'),
72
- $bodyHtml = $('body,html'),
73
- $wrapper = $('#wrapper');
67
+ // Vars.
68
+ var $window = $(window),
69
+ $document = $(document),
70
+ $body = $('body'),
71
+ $html = $('html'),
72
+ $bodyHtml = $('body,html'),
73
+ $wrapper = $('#wrapper');
74
74
 
75
- // Breakpoints.
76
- breakpoints({
77
- xlarge: [ '1281px', '1680px' ],
78
- large: [ '981px', '1280px' ],
79
- medium: [ '737px', '980px' ],
80
- small: [ '481px', '736px' ],
81
- xsmall: [ '361px', '480px' ],
82
- xxsmall: [ null, '360px' ],
83
- short: '(min-aspect-ratio: 16/7)',
84
- xshort: '(min-aspect-ratio: 16/6)'
85
- });
75
+ // Breakpoints.
76
+ breakpoints({
77
+ xlarge: [ '1281px', '1680px' ],
78
+ large: [ '981px', '1280px' ],
79
+ medium: [ '737px', '980px' ],
80
+ small: [ '481px', '736px' ],
81
+ xsmall: [ '361px', '480px' ],
82
+ xxsmall: [ null, '360px' ],
83
+ short: '(min-aspect-ratio: 16/7)',
84
+ xshort: '(min-aspect-ratio: 16/6)'
85
+ });
86
86
 
87
- // Play initial animations on page load.
88
- $window.on('load', function() {
89
- window.setTimeout(function() {
90
- $body.removeClass('is-preload');
91
- }, 100);
92
- });
87
+ // Play initial animations on page load.
88
+ $window.on('load', function() {
89
+ window.setTimeout(function() {
90
+ $body.removeClass('is-preload');
91
+ }, 100);
92
+ });
93
93
 
94
- // Tweaks/fixes.
94
+ // Tweaks/fixes.
95
95
 
96
- // Mobile: Revert to native scrolling.
97
- if (browser.mobile) {
96
+ // Mobile: Revert to native scrolling.
97
+ if (browser.mobile) {
98
98
 
99
- // Disable all scroll-assist features.
100
- settings.keyboardShortcuts.enabled = false;
101
- settings.scrollWheel.enabled = false;
102
- settings.scrollZones.enabled = false;
103
- settings.dragging.enabled = false;
99
+ // Disable all scroll-assist features.
100
+ settings.keyboardShortcuts.enabled = false;
101
+ settings.scrollWheel.enabled = false;
102
+ settings.scrollZones.enabled = false;
103
+ settings.dragging.enabled = false;
104
104
 
105
- // Re-enable overflow on body.
106
- $body.css('overflow-x', 'auto');
105
+ // Re-enable overflow on body.
106
+ $body.css('overflow-x', 'auto');
107
107
 
108
- }
108
+ }
109
109
 
110
- // IE: Various fixes.
111
- if (browser.name == 'ie') {
110
+ // IE: Various fixes.
111
+ if (browser.name == 'ie') {
112
112
 
113
- // Enable IE mode.
114
- $body.addClass('is-ie');
113
+ // Enable IE mode.
114
+ $body.addClass('is-ie');
115
115
 
116
- // Page widths.
117
- $window
118
- .on('load resize', function() {
116
+ // Page widths.
117
+ $window
118
+ .on('load resize', function() {
119
119
 
120
- // Calculate wrapper width.
121
- var w = 0;
120
+ // Calculate wrapper width.
121
+ var w = 0;
122
122
 
123
- $wrapper.children().each(function() {
124
- w += $(this).width();
125
- });
123
+ $wrapper.children().each(function() {
124
+ w += $(this).width();
125
+ });
126
126
 
127
- // Apply to page.
128
- $html.css('width', w + 'px');
127
+ // Apply to page.
128
+ $html.css('width', w + 'px');
129
129
 
130
- });
130
+ });
131
131
 
132
- }
132
+ }
133
133
 
134
- // Polyfill: Object fit.
135
- if (!browser.canUse('object-fit')) {
134
+ // Polyfill: Object fit.
135
+ if (!browser.canUse('object-fit')) {
136
136
 
137
- $('.image[data-position]').each(function() {
137
+ $('.image[data-position]').each(function() {
138
138
 
139
- var $this = $(this),
140
- $img = $this.children('img');
139
+ var $this = $(this),
140
+ $img = $this.children('img');
141
141
 
142
- // Apply img as background.
143
- $this
144
- .css('background-image', 'url("' + $img.attr('src') + '")')
145
- .css('background-position', $this.data('position'))
146
- .css('background-size', 'cover')
147
- .css('background-repeat', 'no-repeat');
142
+ // Apply img as background.
143
+ $this
144
+ .css('background-image', 'url("' + $img.attr('src') + '")')
145
+ .css('background-position', $this.data('position'))
146
+ .css('background-size', 'cover')
147
+ .css('background-repeat', 'no-repeat');
148
148
 
149
- // Hide img.
150
- $img
151
- .css('opacity', '0');
149
+ // Hide img.
150
+ $img
151
+ .css('opacity', '0');
152
152
 
153
- });
153
+ });
154
154
 
155
- }
155
+ }
156
156
 
157
- // Keyboard shortcuts.
158
- if (settings.keyboardShortcuts.enabled)
159
- (function() {
157
+ // Keyboard shortcuts.
158
+ if (settings.keyboardShortcuts.enabled)
159
+ (function() {
160
160
 
161
- $wrapper
161
+ $wrapper
162
162
 
163
- // Prevent keystrokes inside excluded elements from bubbling.
164
- .on('keypress keyup keydown', settings.excludeSelector, function(event) {
163
+ // Prevent keystrokes inside excluded elements from bubbling.
164
+ .on('keypress keyup keydown', settings.excludeSelector, function(event) {
165
165
 
166
- // Stop propagation.
167
- event.stopPropagation();
166
+ // Stop propagation.
167
+ event.stopPropagation();
168
168
 
169
- });
169
+ });
170
170
 
171
- $window
171
+ $window
172
172
 
173
- // Keypress event.
174
- .on('keydown', function(event) {
173
+ // Keypress event.
174
+ .on('keydown', function(event) {
175
175
 
176
- var scrolled = false;
176
+ var scrolled = false;
177
177
 
178
- switch (event.keyCode) {
178
+ switch (event.keyCode) {
179
179
 
180
- // Left arrow.
181
- case 37:
182
- $document.scrollLeft($document.scrollLeft() - settings.keyboardShortcuts.distance);
183
- scrolled = true;
184
- break;
180
+ // Left arrow.
181
+ case 37:
182
+ $document.scrollLeft($document.scrollLeft() - settings.keyboardShortcuts.distance);
183
+ scrolled = true;
184
+ break;
185
185
 
186
- // Right arrow.
187
- case 39:
188
- $document.scrollLeft($document.scrollLeft() + settings.keyboardShortcuts.distance);
189
- scrolled = true;
190
- break;
186
+ // Right arrow.
187
+ case 39:
188
+ $document.scrollLeft($document.scrollLeft() + settings.keyboardShortcuts.distance);
189
+ scrolled = true;
190
+ break;
191
191
 
192
- // Page Up.
193
- case 33:
194
- $document.scrollLeft($document.scrollLeft() - $window.width() + 100);
195
- scrolled = true;
196
- break;
192
+ // Page Up.
193
+ case 33:
194
+ $document.scrollLeft($document.scrollLeft() - $window.width() + 100);
195
+ scrolled = true;
196
+ break;
197
197
 
198
- // Page Down, Space.
199
- case 34:
200
- case 32:
201
- $document.scrollLeft($document.scrollLeft() + $window.width() - 100);
202
- scrolled = true;
203
- break;
198
+ // Page Down, Space.
199
+ case 34:
200
+ case 32:
201
+ $document.scrollLeft($document.scrollLeft() + $window.width() - 100);
202
+ scrolled = true;
203
+ break;
204
204
 
205
- // Home.
206
- case 36:
207
- $document.scrollLeft(0);
208
- scrolled = true;
209
- break;
205
+ // Home.
206
+ case 36:
207
+ $document.scrollLeft(0);
208
+ scrolled = true;
209
+ break;
210
210
 
211
- // End.
212
- case 35:
213
- $document.scrollLeft($document.width());
214
- scrolled = true;
215
- break;
211
+ // End.
212
+ case 35:
213
+ $document.scrollLeft($document.width());
214
+ scrolled = true;
215
+ break;
216
216
 
217
- }
217
+ }
218
218
 
219
- // Scrolled?
220
- if (scrolled) {
219
+ // Scrolled?
220
+ if (scrolled) {
221
221
 
222
- // Prevent default.
223
- event.preventDefault();
224
- event.stopPropagation();
222
+ // Prevent default.
223
+ event.preventDefault();
224
+ event.stopPropagation();
225
225
 
226
- // Stop link scroll.
227
- $bodyHtml.stop();
226
+ // Stop link scroll.
227
+ $bodyHtml.stop();
228
228
 
229
- }
229
+ }
230
230
 
231
- });
231
+ });
232
232
 
233
- })();
233
+ })();
234
234
 
235
- // Scroll wheel.
236
- if (settings.scrollWheel.enabled)
237
- (function() {
235
+ // Scroll wheel.
236
+ if (settings.scrollWheel.enabled)
237
+ (function() {
238
238
 
239
- // Based on code by @miorel + @pieterv of Facebook (thanks guys :)
240
- // github.com/facebook/fixed-data-table/blob/master/src/vendor_upstream/dom/normalizeWheel.js
241
- var normalizeWheel = function(event) {
239
+ // Based on code by @miorel + @pieterv of Facebook (thanks guys :)
240
+ // github.com/facebook/fixed-data-table/blob/master/src/vendor_upstream/dom/normalizeWheel.js
241
+ var normalizeWheel = function(event) {
242
242
 
243
- var pixelStep = 10,
244
- lineHeight = 40,
245
- pageHeight = 800,
246
- sX = 0,
247
- sY = 0,
248
- pX = 0,
249
- pY = 0;
243
+ var pixelStep = 10,
244
+ lineHeight = 40,
245
+ pageHeight = 800,
246
+ sX = 0,
247
+ sY = 0,
248
+ pX = 0,
249
+ pY = 0;
250
250
 
251
- // Legacy.
252
- if ('detail' in event)
253
- sY = event.detail;
254
- else if ('wheelDelta' in event)
255
- sY = event.wheelDelta / -120;
256
- else if ('wheelDeltaY' in event)
257
- sY = event.wheelDeltaY / -120;
251
+ // Legacy.
252
+ if ('detail' in event)
253
+ sY = event.detail;
254
+ else if ('wheelDelta' in event)
255
+ sY = event.wheelDelta / -120;
256
+ else if ('wheelDeltaY' in event)
257
+ sY = event.wheelDeltaY / -120;
258
258
 
259
- if ('wheelDeltaX' in event)
260
- sX = event.wheelDeltaX / -120;
259
+ if ('wheelDeltaX' in event)
260
+ sX = event.wheelDeltaX / -120;
261
261
 
262
- // Side scrolling on FF with DOMMouseScroll.
263
- if ('axis' in event
264
- && event.axis === event.HORIZONTAL_AXIS) {
265
- sX = sY;
266
- sY = 0;
267
- }
262
+ // Side scrolling on FF with DOMMouseScroll.
263
+ if ('axis' in event
264
+ && event.axis === event.HORIZONTAL_AXIS) {
265
+ sX = sY;
266
+ sY = 0;
267
+ }
268
268
 
269
- // Calculate.
270
- pX = sX * pixelStep;
271
- pY = sY * pixelStep;
269
+ // Calculate.
270
+ pX = sX * pixelStep;
271
+ pY = sY * pixelStep;
272
272
 
273
- if ('deltaY' in event)
274
- pY = event.deltaY;
273
+ if ('deltaY' in event)
274
+ pY = event.deltaY;
275
275
 
276
- if ('deltaX' in event)
277
- pX = event.deltaX;
278
-
279
- if ((pX || pY)
280
- && event.deltaMode) {
281
-
282
- if (event.deltaMode == 1) {
283
- pX *= lineHeight;
284
- pY *= lineHeight;
285
- }
286
- else {
287
- pX *= pageHeight;
288
- pY *= pageHeight;
289
- }
290
-
291
- }
292
-
293
- // Fallback if spin cannot be determined.
294
- if (pX && !sX)
295
- sX = (pX < 1) ? -1 : 1;
296
-
297
- if (pY && !sY)
298
- sY = (pY < 1) ? -1 : 1;
299
-
300
- // Return.
301
- return {
302
- spinX: sX,
303
- spinY: sY,
304
- pixelX: pX,
305
- pixelY: pY
306
- };
276
+ if ('deltaX' in event)
277
+ pX = event.deltaX;
278
+
279
+ if ((pX || pY)
280
+ && event.deltaMode) {
281
+
282
+ if (event.deltaMode == 1) {
283
+ pX *= lineHeight;
284
+ pY *= lineHeight;
285
+ }
286
+ else {
287
+ pX *= pageHeight;
288
+ pY *= pageHeight;
289
+ }
290
+
291
+ }
292
+
293
+ // Fallback if spin cannot be determined.
294
+ if (pX && !sX)
295
+ sX = (pX < 1) ? -1 : 1;
296
+
297
+ if (pY && !sY)
298
+ sY = (pY < 1) ? -1 : 1;
299
+
300
+ // Return.
301
+ return {
302
+ spinX: sX,
303
+ spinY: sY,
304
+ pixelX: pX,
305
+ pixelY: pY
306
+ };
307
307
 
308
- };
308
+ };
309
309
 
310
- // Wheel event.
311
- $body.on('wheel', function(event) {
310
+ // Wheel event.
311
+ $body.on('wheel', function(event) {
312
312
 
313
- // Disable on <=small.
314
- if (breakpoints.active('<=small'))
315
- return;
313
+ // Disable on <=small.
314
+ if (breakpoints.active('<=small'))
315
+ return;
316
316
 
317
- // Prevent default.
318
- event.preventDefault();
319
- event.stopPropagation();
317
+ // Prevent default.
318
+ event.preventDefault();
319
+ event.stopPropagation();
320
320
 
321
- // Stop link scroll.
322
- $bodyHtml.stop();
321
+ // Stop link scroll.
322
+ $bodyHtml.stop();
323
323
 
324
- // Calculate delta, direction.
325
- var n = normalizeWheel(event.originalEvent),
326
- x = (n.pixelX != 0 ? n.pixelX : n.pixelY),
327
- delta = Math.min(Math.abs(x), 150) * settings.scrollWheel.factor,
328
- direction = x > 0 ? 1 : -1;
324
+ // Calculate delta, direction.
325
+ var n = normalizeWheel(event.originalEvent),
326
+ x = (n.pixelX != 0 ? n.pixelX : n.pixelY),
327
+ delta = Math.min(Math.abs(x), 150) * settings.scrollWheel.factor,
328
+ direction = x > 0 ? 1 : -1;
329
329
 
330
- // Scroll page.
331
- $document.scrollLeft($document.scrollLeft() + (delta * direction));
330
+ // Scroll page.
331
+ $document.scrollLeft($document.scrollLeft() + (delta * direction));
332
332
 
333
- });
334
-
335
- })();
336
-
337
- // Scroll zones.
338
- if (settings.scrollZones.enabled)
339
- (function() {
340
-
341
- var $left = $('<div class="scrollZone left"></div>'),
342
- $right = $('<div class="scrollZone right"></div>'),
343
- $zones = $left.add($right),
344
- paused = false,
345
- intervalId = null,
346
- direction,
347
- activate = function(d) {
333
+ });
334
+
335
+ })();
336
+
337
+ // Scroll zones.
338
+ if (settings.scrollZones.enabled)
339
+ (function() {
340
+
341
+ var $left = $('<div class="scrollZone left"></div>'),
342
+ $right = $('<div class="scrollZone right"></div>'),
343
+ $zones = $left.add($right),
344
+ paused = false,
345
+ intervalId = null,
346
+ direction,
347
+ activate = function(d) {
348
348
 
349
- // Disable on <=small.
350
- if (breakpoints.active('<=small'))
351
- return;
349
+ // Disable on <=small.
350
+ if (breakpoints.active('<=small'))
351
+ return;
352
352
 
353
- // Paused? Bail.
354
- if (paused)
355
- return;
353
+ // Paused? Bail.
354
+ if (paused)
355
+ return;
356
356
 
357
- // Stop link scroll.
358
- $bodyHtml.stop();
357
+ // Stop link scroll.
358
+ $bodyHtml.stop();
359
359
 
360
- // Set direction.
361
- direction = d;
360
+ // Set direction.
361
+ direction = d;
362
362
 
363
- // Initialize interval.
364
- clearInterval(intervalId);
363
+ // Initialize interval.
364
+ clearInterval(intervalId);
365
365
 
366
- intervalId = setInterval(function() {
367
- $document.scrollLeft($document.scrollLeft() + (settings.scrollZones.speed * direction));
368
- }, 25);
366
+ intervalId = setInterval(function() {
367
+ $document.scrollLeft($document.scrollLeft() + (settings.scrollZones.speed * direction));
368
+ }, 25);
369
369
 
370
- },
371
- deactivate = function() {
370
+ },
371
+ deactivate = function() {
372
372
 
373
- // Unpause.
374
- paused = false;
373
+ // Unpause.
374
+ paused = false;
375
375
 
376
- // Clear interval.
377
- clearInterval(intervalId);
376
+ // Clear interval.
377
+ clearInterval(intervalId);
378
378
 
379
- };
379
+ };
380
380
 
381
- $zones
382
- .appendTo($wrapper)
383
- .on('mouseleave mousedown', function(event) {
384
- deactivate();
385
- });
381
+ $zones
382
+ .appendTo($wrapper)
383
+ .on('mouseleave mousedown', function(event) {
384
+ deactivate();
385
+ });
386
386
 
387
- $left
388
- .css('left', '0')
389
- .on('mouseenter', function(event) {
390
- activate(-1);
391
- });
387
+ $left
388
+ .css('left', '0')
389
+ .on('mouseenter', function(event) {
390
+ activate(-1);
391
+ });
392
392
 
393
- $right
394
- .css('right', '0')
395
- .on('mouseenter', function(event) {
396
- activate(1);
397
- });
393
+ $right
394
+ .css('right', '0')
395
+ .on('mouseenter', function(event) {
396
+ activate(1);
397
+ });
398
398
 
399
- $wrapper
400
- .on('---pauseScrollZone', function(event) {
399
+ $wrapper
400
+ .on('---pauseScrollZone', function(event) {
401
401
 
402
- // Pause.
403
- paused = true;
402
+ // Pause.
403
+ paused = true;
404
404
 
405
- // Unpause after delay.
406
- setTimeout(function() {
407
- paused = false;
408
- }, 500);
405
+ // Unpause after delay.
406
+ setTimeout(function() {
407
+ paused = false;
408
+ }, 500);
409
409
 
410
- });
410
+ });
411
411
 
412
- })();
412
+ })();
413
413
 
414
- // Dragging.
415
- if (settings.dragging.enabled)
416
- (function() {
414
+ // Dragging.
415
+ if (settings.dragging.enabled)
416
+ (function() {
417
417
 
418
- var dragging = false,
419
- dragged = false,
420
- distance = 0,
421
- startScroll,
422
- momentumIntervalId, velocityIntervalId,
423
- startX, currentX, previousX,
424
- velocity, direction;
418
+ var dragging = false,
419
+ dragged = false,
420
+ distance = 0,
421
+ startScroll,
422
+ momentumIntervalId, velocityIntervalId,
423
+ startX, currentX, previousX,
424
+ velocity, direction;
425
425
 
426
- $wrapper
426
+ $wrapper
427
427
 
428
- // Prevent image drag and drop.
429
- .on('mouseup mousemove mousedown', '.image, img', function(event) {
430
- event.preventDefault();
431
- })
428
+ // Prevent image drag and drop.
429
+ .on('mouseup mousemove mousedown', '.image, img', function(event) {
430
+ event.preventDefault();
431
+ })
432
432
 
433
- // Prevent mouse events inside excluded elements from bubbling.
434
- .on('mouseup mousemove mousedown', settings.excludeSelector, function(event) {
433
+ // Prevent mouse events inside excluded elements from bubbling.
434
+ .on('mouseup mousemove mousedown', settings.excludeSelector, function(event) {
435
435
 
436
- // Prevent event from bubbling.
437
- event.stopPropagation();
436
+ // Prevent event from bubbling.
437
+ event.stopPropagation();
438
438
 
439
- // End drag.
440
- dragging = false;
441
- $wrapper.removeClass('is-dragging');
442
- clearInterval(velocityIntervalId);
443
- clearInterval(momentumIntervalId);
439
+ // End drag.
440
+ dragging = false;
441
+ $wrapper.removeClass('is-dragging');
442
+ clearInterval(velocityIntervalId);
443
+ clearInterval(momentumIntervalId);
444
444
 
445
- // Pause scroll zone.
446
- $wrapper.triggerHandler('---pauseScrollZone');
445
+ // Pause scroll zone.
446
+ $wrapper.triggerHandler('---pauseScrollZone');
447
447
 
448
- })
448
+ })
449
449
 
450
- // Mousedown event.
451
- .on('mousedown', function(event) {
450
+ // Mousedown event.
451
+ .on('mousedown', function(event) {
452
452
 
453
- // Disable on <=small.
454
- if (breakpoints.active('<=small'))
455
- return;
453
+ // Disable on <=small.
454
+ if (breakpoints.active('<=small'))
455
+ return;
456
456
 
457
- // Clear momentum interval.
458
- clearInterval(momentumIntervalId);
457
+ // Clear momentum interval.
458
+ clearInterval(momentumIntervalId);
459
459
 
460
- // Stop link scroll.
461
- $bodyHtml.stop();
460
+ // Stop link scroll.
461
+ $bodyHtml.stop();
462
462
 
463
- // Start drag.
464
- dragging = true;
465
- $wrapper.addClass('is-dragging');
463
+ // Start drag.
464
+ dragging = true;
465
+ $wrapper.addClass('is-dragging');
466
466
 
467
- // Initialize and reset vars.
468
- startScroll = $document.scrollLeft();
469
- startX = event.clientX;
470
- previousX = startX;
471
- currentX = startX;
472
- distance = 0;
473
- direction = 0;
467
+ // Initialize and reset vars.
468
+ startScroll = $document.scrollLeft();
469
+ startX = event.clientX;
470
+ previousX = startX;
471
+ currentX = startX;
472
+ distance = 0;
473
+ direction = 0;
474
474
 
475
- // Initialize velocity interval.
476
- clearInterval(velocityIntervalId);
475
+ // Initialize velocity interval.
476
+ clearInterval(velocityIntervalId);
477
477
 
478
- velocityIntervalId = setInterval(function() {
478
+ velocityIntervalId = setInterval(function() {
479
479
 
480
- // Calculate velocity, direction.
481
- velocity = Math.abs(currentX - previousX);
482
- direction = (currentX > previousX ? -1 : 1);
480
+ // Calculate velocity, direction.
481
+ velocity = Math.abs(currentX - previousX);
482
+ direction = (currentX > previousX ? -1 : 1);
483
483
 
484
- // Update previous X.
485
- previousX = currentX;
484
+ // Update previous X.
485
+ previousX = currentX;
486
486
 
487
- }, 50);
487
+ }, 50);
488
488
 
489
- })
489
+ })
490
490
 
491
- // Mousemove event.
492
- .on('mousemove', function(event) {
491
+ // Mousemove event.
492
+ .on('mousemove', function(event) {
493
493
 
494
- // Not dragging? Bail.
495
- if (!dragging)
496
- return;
494
+ // Not dragging? Bail.
495
+ if (!dragging)
496
+ return;
497
497
 
498
- // Velocity.
499
- currentX = event.clientX;
498
+ // Velocity.
499
+ currentX = event.clientX;
500
500
 
501
- // Scroll page.
502
- $document.scrollLeft(startScroll + (startX - currentX));
501
+ // Scroll page.
502
+ $document.scrollLeft(startScroll + (startX - currentX));
503
503
 
504
- // Update distance.
505
- distance = Math.abs(startScroll - $document.scrollLeft());
504
+ // Update distance.
505
+ distance = Math.abs(startScroll - $document.scrollLeft());
506
506
 
507
- // Distance exceeds threshold? Disable pointer events on all descendents.
508
- if (!dragged
509
- && distance > settings.dragging.threshold) {
507
+ // Distance exceeds threshold? Disable pointer events on all descendents.
508
+ if (!dragged
509
+ && distance > settings.dragging.threshold) {
510
510
 
511
- $wrapper.addClass('is-dragged');
511
+ $wrapper.addClass('is-dragged');
512
512
 
513
- dragged = true;
513
+ dragged = true;
514
514
 
515
- }
515
+ }
516
516
 
517
- })
517
+ })
518
518
 
519
- // Mouseup/mouseleave event.
520
- .on('mouseup mouseleave', function(event) {
519
+ // Mouseup/mouseleave event.
520
+ .on('mouseup mouseleave', function(event) {
521
521
 
522
- var m;
522
+ var m;
523
523
 
524
- // Not dragging? Bail.
525
- if (!dragging)
526
- return;
524
+ // Not dragging? Bail.
525
+ if (!dragging)
526
+ return;
527
527
 
528
- // Dragged? Re-enable pointer events on all descendents.
529
- if (dragged) {
528
+ // Dragged? Re-enable pointer events on all descendents.
529
+ if (dragged) {
530
530
 
531
- setTimeout(function() {
532
- $wrapper.removeClass('is-dragged');
533
- }, 100);
531
+ setTimeout(function() {
532
+ $wrapper.removeClass('is-dragged');
533
+ }, 100);
534
534
 
535
- dragged = false;
535
+ dragged = false;
536
536
 
537
- }
537
+ }
538
538
 
539
- // Distance exceeds threshold? Prevent default.
540
- if (distance > settings.dragging.threshold)
541
- event.preventDefault();
539
+ // Distance exceeds threshold? Prevent default.
540
+ if (distance > settings.dragging.threshold)
541
+ event.preventDefault();
542
542
 
543
- // End drag.
544
- dragging = false;
545
- $wrapper.removeClass('is-dragging');
546
- clearInterval(velocityIntervalId);
547
- clearInterval(momentumIntervalId);
543
+ // End drag.
544
+ dragging = false;
545
+ $wrapper.removeClass('is-dragging');
546
+ clearInterval(velocityIntervalId);
547
+ clearInterval(momentumIntervalId);
548
548
 
549
- // Pause scroll zone.
550
- $wrapper.triggerHandler('---pauseScrollZone');
549
+ // Pause scroll zone.
550
+ $wrapper.triggerHandler('---pauseScrollZone');
551
551
 
552
- // Initialize momentum interval.
553
- if (settings.dragging.momentum > 0) {
552
+ // Initialize momentum interval.
553
+ if (settings.dragging.momentum > 0) {
554
554
 
555
- m = velocity;
555
+ m = velocity;
556
556
 
557
- momentumIntervalId = setInterval(function() {
557
+ momentumIntervalId = setInterval(function() {
558
558
 
559
- // Momentum is NaN? Bail.
560
- if (isNaN(m)) {
559
+ // Momentum is NaN? Bail.
560
+ if (isNaN(m)) {
561
561
 
562
- clearInterval(momentumIntervalId);
563
- return;
562
+ clearInterval(momentumIntervalId);
563
+ return;
564
564
 
565
- }
565
+ }
566
566
 
567
- // Scroll page.
568
- $document.scrollLeft($document.scrollLeft() + (m * direction));
567
+ // Scroll page.
568
+ $document.scrollLeft($document.scrollLeft() + (m * direction));
569
569
 
570
- // Decrease momentum.
571
- m = m * settings.dragging.momentum;
570
+ // Decrease momentum.
571
+ m = m * settings.dragging.momentum;
572
572
 
573
- // Negligible momentum? Clear interval and end.
574
- if (Math.abs(m) < 1)
575
- clearInterval(momentumIntervalId);
573
+ // Negligible momentum? Clear interval and end.
574
+ if (Math.abs(m) < 1)
575
+ clearInterval(momentumIntervalId);
576
576
 
577
- }, 15);
577
+ }, 15);
578
578
 
579
- }
579
+ }
580
580
 
581
- });
581
+ });
582
582
 
583
- })();
583
+ })();
584
584
 
585
- // Link scroll.
586
- $wrapper
587
- .on('mousedown mouseup', 'a[href^="#"]', function(event) {
585
+ // Link scroll.
586
+ $wrapper
587
+ .on('mousedown mouseup', 'a[href^="#"]', function(event) {
588
588
 
589
- // Stop propagation.
590
- event.stopPropagation();
589
+ // Stop propagation.
590
+ event.stopPropagation();
591
591
 
592
- })
593
- .on('click', 'a[href^="#"]', function(event) {
592
+ })
593
+ .on('click', 'a[href^="#"]', function(event) {
594
594
 
595
- var $this = $(this),
596
- href = $this.attr('href'),
597
- $target, x, y;
595
+ var $this = $(this),
596
+ href = $this.attr('href'),
597
+ $target, x, y;
598
598
 
599
- // Get target.
600
- if (href == '#'
601
- || ($target = $(href)).length == 0)
602
- return;
599
+ // Get target.
600
+ if (href == '#'
601
+ || ($target = $(href)).length == 0)
602
+ return;
603
603
 
604
- // Prevent default.
605
- event.preventDefault();
606
- event.stopPropagation();
604
+ // Prevent default.
605
+ event.preventDefault();
606
+ event.stopPropagation();
607
607
 
608
- // Calculate x, y.
609
- if (breakpoints.active('<=small')) {
608
+ // Calculate x, y.
609
+ if (breakpoints.active('<=small')) {
610
610
 
611
- x = $target.offset().top - (Math.max(0, $window.height() - $target.outerHeight()) / 2);
612
- y = { scrollTop: x };
611
+ x = $target.offset().top - (Math.max(0, $window.height() - $target.outerHeight()) / 2);
612
+ y = { scrollTop: x };
613
613
 
614
- }
615
- else {
614
+ }
615
+ else {
616
616
 
617
- x = $target.offset().left - (Math.max(0, $window.width() - $target.outerWidth()) / 2);
618
- y = { scrollLeft: x };
617
+ x = $target.offset().left - (Math.max(0, $window.width() - $target.outerWidth()) / 2);
618
+ y = { scrollLeft: x };
619
619
 
620
- }
620
+ }
621
621
 
622
- // Scroll.
623
- $bodyHtml
624
- .stop()
625
- .animate(
626
- y,
627
- settings.linkScrollSpeed,
628
- 'swing'
629
- );
622
+ // Scroll.
623
+ $bodyHtml
624
+ .stop()
625
+ .animate(
626
+ y,
627
+ settings.linkScrollSpeed,
628
+ 'swing'
629
+ );
630
630
 
631
- });
631
+ });
632
632
 
633
- // Gallery.
634
- $('.gallery')
635
- .on('click', 'a', function(event) {
633
+ // Gallery.
634
+ $('.gallery')
635
+ .on('click', 'a', function(event) {
636
636
 
637
- var $a = $(this),
638
- $gallery = $a.parents('.gallery'),
639
- $modal = $gallery.children('.modal'),
640
- $modalImg = $modal.find('img'),
641
- href = $a.attr('href');
637
+ var $a = $(this),
638
+ $gallery = $a.parents('.gallery'),
639
+ $modal = $gallery.children('.modal'),
640
+ $modalImg = $modal.find('img'),
641
+ href = $a.attr('href');
642
642
 
643
- // Not an image? Bail.
644
- if (!href.match(/\.(jpg|gif|png|mp4)$/))
645
- return;
643
+ // Not an image? Bail.
644
+ if (!href.match(/\.(jpg|gif|png|mp4)$/))
645
+ return;
646
646
 
647
- // Prevent default.
648
- event.preventDefault();
649
- event.stopPropagation();
647
+ // Prevent default.
648
+ event.preventDefault();
649
+ event.stopPropagation();
650
650
 
651
- // Locked? Bail.
652
- if ($modal[0]._locked)
653
- return;
651
+ // Locked? Bail.
652
+ if ($modal[0]._locked)
653
+ return;
654
654
 
655
- // Lock.
656
- $modal[0]._locked = true;
655
+ // Lock.
656
+ $modal[0]._locked = true;
657
657
 
658
- // Set src.
659
- $modalImg.attr('src', href);
658
+ // Set src.
659
+ $modalImg.attr('src', href);
660
660
 
661
- // Set visible.
662
- $modal.addClass('visible');
661
+ // Set visible.
662
+ $modal.addClass('visible');
663
663
 
664
- // Focus.
665
- $modal.focus();
664
+ // Focus.
665
+ $modal.focus();
666
666
 
667
- // Delay.
668
- setTimeout(function() {
667
+ // Delay.
668
+ setTimeout(function() {
669
669
 
670
- // Unlock.
671
- $modal[0]._locked = false;
670
+ // Unlock.
671
+ $modal[0]._locked = false;
672
672
 
673
- }, 600);
673
+ }, 600);
674
674
 
675
- })
676
- .on('click', '.modal', function(event) {
675
+ })
676
+ .on('click', '.modal', function(event) {
677
677
 
678
- var $modal = $(this),
679
- $modalImg = $modal.find('img');
678
+ var $modal = $(this),
679
+ $modalImg = $modal.find('img');
680
680
 
681
- // Locked? Bail.
682
- if ($modal[0]._locked)
683
- return;
681
+ // Locked? Bail.
682
+ if ($modal[0]._locked)
683
+ return;
684
684
 
685
- // Already hidden? Bail.
686
- if (!$modal.hasClass('visible'))
687
- return;
685
+ // Already hidden? Bail.
686
+ if (!$modal.hasClass('visible'))
687
+ return;
688
688
 
689
- // Stop propagation.
690
- event.stopPropagation();
689
+ // Stop propagation.
690
+ event.stopPropagation();
691
691
 
692
- // Lock.
693
- $modal[0]._locked = true;
692
+ // Lock.
693
+ $modal[0]._locked = true;
694
694
 
695
- // Clear visible, loaded.
696
- $modal
697
- .removeClass('loaded')
695
+ // Clear visible, loaded.
696
+ $modal
697
+ .removeClass('loaded')
698
698
 
699
- // Delay.
700
- setTimeout(function() {
699
+ // Delay.
700
+ setTimeout(function() {
701
701
 
702
- $modal
703
- .removeClass('visible')
702
+ $modal
703
+ .removeClass('visible')
704
704
 
705
- // Pause scroll zone.
706
- $wrapper.triggerHandler('---pauseScrollZone');
705
+ // Pause scroll zone.
706
+ $wrapper.triggerHandler('---pauseScrollZone');
707
707
 
708
- setTimeout(function() {
708
+ setTimeout(function() {
709
709
 
710
- // Clear src.
711
- $modalImg.attr('src', '');
710
+ // Clear src.
711
+ $modalImg.attr('src', '');
712
712
 
713
- // Unlock.
714
- $modal[0]._locked = false;
713
+ // Unlock.
714
+ $modal[0]._locked = false;
715
715
 
716
- // Focus.
717
- $body.focus();
716
+ // Focus.
717
+ $body.focus();
718
718
 
719
- }, 475);
719
+ }, 475);
720
720
 
721
- }, 125);
721
+ }, 125);
722
722
 
723
- })
724
- .on('keypress', '.modal', function(event) {
723
+ })
724
+ .on('keypress', '.modal', function(event) {
725
725
 
726
- var $modal = $(this);
726
+ var $modal = $(this);
727
727
 
728
- // Escape? Hide modal.
729
- if (event.keyCode == 27)
730
- $modal.trigger('click');
728
+ // Escape? Hide modal.
729
+ if (event.keyCode == 27)
730
+ $modal.trigger('click');
731
731
 
732
- })
733
- .on('mouseup mousedown mousemove', '.modal', function(event) {
732
+ })
733
+ .on('mouseup mousedown mousemove', '.modal', function(event) {
734
734
 
735
- // Stop propagation.
736
- event.stopPropagation();
735
+ // Stop propagation.
736
+ event.stopPropagation();
737
737
 
738
- })
739
- .prepend('<div class="modal" tabIndex="-1"><div class="inner"><img src="" /></div></div>')
740
- .find('img')
741
- .on('load', function(event) {
738
+ })
739
+ .prepend('<div class="modal" tabIndex="-1"><div class="inner"><img src="" /></div></div>')
740
+ .find('img')
741
+ .on('load', function(event) {
742
742
 
743
- var $modalImg = $(this),
744
- $modal = $modalImg.parents('.modal');
743
+ var $modalImg = $(this),
744
+ $modal = $modalImg.parents('.modal');
745
745
 
746
- setTimeout(function() {
746
+ setTimeout(function() {
747
747
 
748
- // No longer visible? Bail.
749
- if (!$modal.hasClass('visible'))
750
- return;
748
+ // No longer visible? Bail.
749
+ if (!$modal.hasClass('visible'))
750
+ return;
751
751
 
752
- // Set loaded.
753
- $modal.addClass('loaded');
752
+ // Set loaded.
753
+ $modal.addClass('loaded');
754
754
 
755
- }, 275);
755
+ }, 275);
756
756
 
757
- });
757
+ });
758
758
 
759
- })(jQuery);
759
+ })(jQuery);