opposition-theme 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +48 -0
  4. data/_includes/.DS_Store +0 -0
  5. data/_includes/footer.html +12 -0
  6. data/_includes/head.html +21 -0
  7. data/_includes/header.html +13 -0
  8. data/_includes/scripts.html +7 -0
  9. data/_includes/sidebar.html +35 -0
  10. data/_layouts/.DS_Store +0 -0
  11. data/_layouts/default.html +20 -0
  12. data/_layouts/home.html +28 -0
  13. data/_layouts/page.html +39 -0
  14. data/_layouts/post.html +23 -0
  15. data/_sass/.DS_Store +0 -0
  16. data/_sass/base/_footer.scss +54 -0
  17. data/_sass/base/_header.scss +64 -0
  18. data/_sass/base/_reset.scss +65 -0
  19. data/_sass/base/_sidebar.scss +29 -0
  20. data/_sass/home/.DS_Store +0 -0
  21. data/_sass/home/_about.scss +125 -0
  22. data/_sass/home/_contact.scss +70 -0
  23. data/_sass/home/_home.scss +102 -0
  24. data/_sass/home/_partners.scss +136 -0
  25. data/_sass/home/_services.scss +100 -0
  26. data/_sass/home/_testimonial.scss +61 -0
  27. data/_sass/opposition.scss +139 -0
  28. data/_sass/page/_news.scss +91 -0
  29. data/_sass/post/_post.scss +19 -0
  30. data/assets/.DS_Store +0 -0
  31. data/assets/img/.DS_Store +0 -0
  32. data/assets/img/21savage.jpg +0 -0
  33. data/assets/img/Eye.svg +20 -0
  34. data/assets/img/Phoenix.svg +17 -0
  35. data/assets/img/about.jpg +0 -0
  36. data/assets/img/azae.png +0 -0
  37. data/assets/img/bird.jpg +0 -0
  38. data/assets/img/bird/.DS_Store +0 -0
  39. data/assets/img/bird/A-Rocks.png +0 -0
  40. data/assets/img/bird/B-Light.png +0 -0
  41. data/assets/img/bird/C-Particles.png +0 -0
  42. data/assets/img/bird/D-Particles.png +0 -0
  43. data/assets/img/bird/E-Phoenix.png +0 -0
  44. data/assets/img/bird/F-Fire.png +0 -0
  45. data/assets/img/bird/G-Dust.png +0 -0
  46. data/assets/img/bird/H-Stuff.png +0 -0
  47. data/assets/img/bird/bg.png +0 -0
  48. data/assets/img/contact.png +0 -0
  49. data/assets/img/hnhh.png +0 -0
  50. data/assets/img/home.jpg +0 -0
  51. data/assets/img/icon.gif +0 -0
  52. data/assets/img/logic.jpg +0 -0
  53. data/assets/img/logo.png +0 -0
  54. data/assets/img/logo.svg +32 -0
  55. data/assets/img/meechie.jpg +0 -0
  56. data/assets/img/opposition-blog-header.jpg +0 -0
  57. data/assets/img/opposition_seal.png +0 -0
  58. data/assets/img/s.png +0 -0
  59. data/assets/img/services-bg.jpg +0 -0
  60. data/assets/img/support.svg +31 -0
  61. data/assets/js/.DS_Store +0 -0
  62. data/assets/js/all.js +41 -0
  63. data/assets/js/form.js +114 -0
  64. data/assets/js/parallax.js +550 -0
  65. data/assets/main.scss +5 -0
  66. metadata +150 -0
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 21.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ viewBox="0 0 396 144" style="enable-background:new 0 0 396 144;" xml:space="preserve">
6
+ <style type="text/css">
7
+ .st0{fill:#C1A469;}
8
+ </style>
9
+ <path class="st0" d="M214.7,6.8c-2.2,0.6-7.5,2.1-8.8,2.4c-0.2,0-0.3,0.2-0.4,0.3c-1.4,2.6-4.2,5.6-7.4,5.6c-3.2,0-6-3.1-7.4-5.6
10
+ c-0.1-0.2-0.2-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c0.2-0.2,0.4-0.3,0.6-0.5
28
+ c0,0,0.1,0,0.1-0.1C236.3,119.4,235.1,118.2,234.4,117.6z M184.7,82.2L184.7,82.2v0.1V82.2z M211.4,77.6c-0.2,1.6-1.3,2.9-2.3,3.7
29
+ c-0.5,0.5-0.5,1.4,0,1.9c0.9,0.8,2.1,2.2,2.3,3.7v29.2c0,3.3-0.4,4.2-3.2,6.9c-3.2,3.1-10,6.2-10.1,6.3c-0.2-0.1-6.9-3.2-10.1-6.3
30
+ c-2.8-2.7-3.2-3.6-3.2-6.9V92.9l0,0c0,0,0-3.4,0-5.6c0-1.7,1.3-3.3,2.3-4.2c0.5-0.5,0.5-1.4,0-1.9c-1-0.9-2.3-2.4-2.3-4.2
31
+ c0-2.2,0-5.6,0-5.6l0,0V44.9c0-2.6,1.4-4.9,3.7-6.2l9.6-5.3l9.6,5.3c2.3,1.2,3.7,3.6,3.7,6.2V77.6z"/>
32
+ </svg>
Binary file
Binary file
data/assets/img/s.png ADDED
Binary file
Binary file
@@ -0,0 +1,31 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="44" height="44" viewBox="0 0 44 44">
2
+ <metadata><?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
3
+ <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.6-c138 79.159824, 2016/09/14-01:09:01 ">
4
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
5
+ <rdf:Description rdf:about=""/>
6
+ </rdf:RDF>
7
+ </x:xmpmeta>
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+ <?xpacket end="w"?></metadata>
30
+ <image id="_03" data-name="03" width="44" height="44" xlink:href="data:img/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAMAAAApWqozAAAABG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4XU+VsSQRgH8HciSqw00MQCDC1FK0mzGw01pSi786ikLIusNYtM6dCMDjO7D7W775/a7sKys8XMvj/MvLPP55l9592DyBLLHMsB54qV5hXGhYUWuVC8avWaklKstcVuT1l5NluHCjvsdebTSqyX4w1wmwsf/FIcqOJvg41SHKzmcc0m+c6bLbhEimvreByS4/oGHm/ZKsXYZjlgowyHtzfxuBk7xLgFOy2PnnbtluE9VhzYKyljH8p5ux8RaetauUUbDki7EUW7uegASTG5OvNpJQ7a4C50x7LZIRwmG0wRxPX5CMJki+lottIekD3uOlarz8dxwg6fPIXTUT1zn8HZXhlu8QF9+VX/AFznhPi8B5bXmS4MInGxIL4UwFCM/onLVyIFcO8wGq9SwbhWlwxd7xy5YeCbCkZvFabUh7HRhtt34hhL6fguEuMCSgPqkfUt74UxoeHJoIhSWvtYcuXexwMVP/SKbAqPuAP2YIrR9GMRxozZ5zbGnmQYPS0T2Gd4buDYi2rGmtSiukU47TWeoL++dFadgs30EnPpyf+in0ipMvCreb0U5TXRG0firTUcSUU9WkYreaKDsZDTr+P4oLBv5HinDu8xpMzn+pGZE+OKGm38AI/RPHwU40+Y1abPX3I2hSIxpuGk2Wc1PNNMgqf0/4xhZ7Agw7SIxTxewlcmxaoe+bagvXTffyDKbDCNt/4sXvL9+o0/7dr2fwEXVIYjhUg8pgAAAABJRU5ErkJggg=="/>
31
+ </svg>
Binary file
data/assets/js/all.js ADDED
@@ -0,0 +1,41 @@
1
+ $(document).on('click', '.page-link', function(event){
2
+ event.preventDefault();
3
+
4
+ var link = $.attr(this, 'href')
5
+ var noSlashLink = link.replace(/\//g, "")
6
+
7
+ $('html, body').animate({
8
+ scrollTop: $( noSlashLink ).offset().top - 75
9
+ }, 500);
10
+ });
11
+
12
+ function resize() {
13
+ var heights = window.innerHeight;
14
+ var homeDiv = document.getElementById("home");
15
+
16
+ homeDiv.style.height = heights + "px";
17
+ homeDiv.style.minHeight = heights + "px";
18
+ // if(homeDiv) {
19
+ // homeDiv.style.height = heights + "px";
20
+ // homeDiv.style.minHeight = heights + "px";
21
+ // }
22
+ }
23
+
24
+ window.onresize = function() {
25
+ resize();
26
+ };
27
+
28
+ resize();
29
+
30
+ $(function() {
31
+ var counterAmount = parseInt($('#views-counter span').text());
32
+ var scene = document.getElementById('scene');
33
+ var parallax = new Parallax(scene);
34
+
35
+ setInterval(function() {
36
+ var randomnumber = Math.floor(Math.random() * (500 - 100)) + 100;
37
+
38
+ counterAmount = counterAmount + randomnumber;
39
+ $('#views-counter span').text(counterAmount + ' views');
40
+ }, 1000);
41
+ })
data/assets/js/form.js ADDED
@@ -0,0 +1,114 @@
1
+ function submitForm() {
2
+ var formData = 'form=' + $('.formstack input[name=form]').val();
3
+
4
+ $('.fsField').each( function() {
5
+ formData += '&' + $(this).attr('id') + '=' + $(this).val();
6
+ });
7
+
8
+ $.ajax({
9
+ url: 'http://quickonboarding.viso.tv/formstack.php',
10
+ async: false,
11
+ type:'POST',
12
+ data:formData,
13
+ success:function ( data ) {
14
+ $('.formstack').fadeOut();
15
+ $('.thanks').fadeIn();
16
+ },
17
+ });
18
+ }
19
+
20
+ function validateForm(e) {
21
+ var el = e.target;
22
+ var emailReg = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
23
+
24
+ // Check input fields
25
+ if(e.value == null) {
26
+ el.classList.add('required')
27
+ } else {
28
+ el.classList.remove('required')
29
+ }
30
+
31
+ // Check email fields
32
+ if(el.type == 'email' && !emailReg.test(el.value)) {
33
+ el.classList.add('required')
34
+ }
35
+ else {
36
+ el.classList.remove('required')
37
+ }
38
+
39
+ // Toggle submit button
40
+ if($('.fsField').hasClass('required')) {
41
+ $('.submit').addClass('disabled')
42
+ } else {
43
+ $('.submit').removeClass('disabled')
44
+ }
45
+
46
+ // Clear if any empty fields
47
+ if($('.fsField').val() == '') {
48
+ $('.submit').addClass('disabled')
49
+ }
50
+ }
51
+
52
+ $(document).ready(function(e) {
53
+ $('.fsField').focus(function(e) {
54
+ validateForm(e);
55
+ })
56
+
57
+ $('.fsField').blur(function(e) {
58
+ validateForm(e);
59
+ })
60
+ });
61
+
62
+ // jQuery('form .submit').click(function(e) {
63
+ // e.preventDefault(); // Cancel the form submit action
64
+ // var form_id = jQuery(this).parents('form').attr('id');
65
+ // var this_form = "fsForm1775897";
66
+
67
+ // var inputs = jQuery('#'+this_form+' .fsRequired');
68
+ // var extraInputs = jQuery('#'+this_form+' textarea, #'+this_form+' input[type=checkbox]:checked');
69
+ // var emailReg = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
70
+
71
+ // jQuery(inputs).each( function() {
72
+ // if (jQuery(this).val() == "") {
73
+ // jQuery(this)
74
+ // .addClass('required');
75
+ // } else {
76
+ // jQuery(this)
77
+ // .removeClass('required');
78
+ // }
79
+ // });
80
+
81
+ // if (!emailReg.test(jQuery('#'+this_form+' input.email').val())) {
82
+ // jQuery('#'+this_form+' input.email').addClass('required');
83
+ // } else {
84
+ // jQuery('#'+this_form+' input.email').removeClass('required');
85
+ // }
86
+
87
+ // if ( inputs.hasClass('required') ) {
88
+ // jQuery('.error').fadeIn();
89
+ // } else {
90
+ // jQuery('.error').fadeOut();
91
+ // }
92
+
93
+ // if ( !inputs.hasClass('required') ) {
94
+ // var formData = "form=" + jQuery(".formstack input[name=form]").val();
95
+
96
+ // jQuery(inputs).each( function() {
97
+ // formData += "&" + jQuery(this).attr("id") + "=" + jQuery(this).val();
98
+ // });
99
+ // jQuery(extraInputs).each( function() {
100
+ // formData += "&" + jQuery(this).attr("id") + "=" + jQuery(this).val();
101
+ // });
102
+
103
+ // jQuery.ajax({
104
+ // url: "http://quickonboarding.viso.tv/formstack.php",
105
+ // async: false,
106
+ // type:"POST",
107
+ // data:formData,
108
+ // success:function ( data ) {
109
+ // jQuery('.formstack').fadeOut();
110
+ // jQuery('.thanks').fadeIn();
111
+ // },
112
+ // });
113
+ // }
114
+ // });
@@ -0,0 +1,550 @@
1
+ /**
2
+ * Parallax.js
3
+ * @author Matthew Wagerfield - @wagerfield
4
+ * @description Creates a parallax effect between an array of layers,
5
+ * driving the motion from the gyroscope output of a smartdevice.
6
+ * If no gyroscope is available, the cursor position is used.
7
+ */
8
+ ;(function(window, document, undefined) {
9
+
10
+ // Strict Mode
11
+ 'use strict';
12
+
13
+ // Constants
14
+ var NAME = 'Parallax';
15
+ var MAGIC_NUMBER = 30;
16
+ var DEFAULTS = {
17
+ relativeInput: false,
18
+ clipRelativeInput: false,
19
+ calibrationThreshold: 100,
20
+ calibrationDelay: 500,
21
+ supportDelay: 500,
22
+ calibrateX: false,
23
+ calibrateY: true,
24
+ invertX: true,
25
+ invertY: true,
26
+ limitX: false,
27
+ limitY: false,
28
+ scalarX: 10.0,
29
+ scalarY: 10.0,
30
+ frictionX: 0.1,
31
+ frictionY: 0.1,
32
+ originX: 0.5,
33
+ originY: 0.5,
34
+ pointerEvents: true,
35
+ precision: 1
36
+ };
37
+
38
+ function Parallax(element, options) {
39
+
40
+ // DOM Context
41
+ this.element = element;
42
+ this.layers = element.getElementsByClassName('layer');
43
+
44
+ // Data Extraction
45
+ var data = {
46
+ calibrateX: this.data(this.element, 'calibrate-x'),
47
+ calibrateY: this.data(this.element, 'calibrate-y'),
48
+ invertX: this.data(this.element, 'invert-x'),
49
+ invertY: this.data(this.element, 'invert-y'),
50
+ limitX: this.data(this.element, 'limit-x'),
51
+ limitY: this.data(this.element, 'limit-y'),
52
+ scalarX: this.data(this.element, 'scalar-x'),
53
+ scalarY: this.data(this.element, 'scalar-y'),
54
+ frictionX: this.data(this.element, 'friction-x'),
55
+ frictionY: this.data(this.element, 'friction-y'),
56
+ originX: this.data(this.element, 'origin-x'),
57
+ originY: this.data(this.element, 'origin-y'),
58
+ pointerEvents: this.data(this.element, 'pointer-events'),
59
+ precision: this.data(this.element, 'precision')
60
+ };
61
+
62
+ // Delete Null Data Values
63
+ for (var key in data) {
64
+ if (data[key] === null) delete data[key];
65
+ }
66
+
67
+ // Compose Settings Object
68
+ this.extend(this, DEFAULTS, options, data);
69
+
70
+ // States
71
+ this.calibrationTimer = null;
72
+ this.calibrationFlag = true;
73
+ this.enabled = false;
74
+ this.depthsX = [];
75
+ this.depthsY = [];
76
+ this.raf = null;
77
+
78
+ // Element Bounds
79
+ this.bounds = null;
80
+ this.ex = 0;
81
+ this.ey = 0;
82
+ this.ew = 0;
83
+ this.eh = 0;
84
+
85
+ // Element Center
86
+ this.ecx = 0;
87
+ this.ecy = 0;
88
+
89
+ // Element Range
90
+ this.erx = 0;
91
+ this.ery = 0;
92
+
93
+ // Calibration
94
+ this.cx = 0;
95
+ this.cy = 0;
96
+
97
+ // Input
98
+ this.ix = 0;
99
+ this.iy = 0;
100
+
101
+ // Motion
102
+ this.mx = 0;
103
+ this.my = 0;
104
+
105
+ // Velocity
106
+ this.vx = 0;
107
+ this.vy = 0;
108
+
109
+ // Callbacks
110
+ this.onMouseMove = this.onMouseMove.bind(this);
111
+ this.onDeviceOrientation = this.onDeviceOrientation.bind(this);
112
+ this.onOrientationTimer = this.onOrientationTimer.bind(this);
113
+ this.onCalibrationTimer = this.onCalibrationTimer.bind(this);
114
+ this.onAnimationFrame = this.onAnimationFrame.bind(this);
115
+ this.onWindowResize = this.onWindowResize.bind(this);
116
+
117
+ // Initialise
118
+ this.initialise();
119
+ }
120
+
121
+ Parallax.prototype.extend = function() {
122
+ if (arguments.length > 1) {
123
+ var master = arguments[0];
124
+ for (var i = 1, l = arguments.length; i < l; i++) {
125
+ var object = arguments[i];
126
+ for (var key in object) {
127
+ master[key] = object[key];
128
+ }
129
+ }
130
+ }
131
+ };
132
+
133
+ Parallax.prototype.data = function(element, name) {
134
+ return this.deserialize(element.getAttribute('data-'+name));
135
+ };
136
+
137
+ Parallax.prototype.deserialize = function(value) {
138
+ if (value === 'true') {
139
+ return true;
140
+ } else if (value === 'false') {
141
+ return false;
142
+ } else if (value === 'null') {
143
+ return null;
144
+ } else if (!isNaN(parseFloat(value)) && isFinite(value)) {
145
+ return parseFloat(value);
146
+ } else {
147
+ return value;
148
+ }
149
+ };
150
+
151
+ Parallax.prototype.camelCase = function(value) {
152
+ return value.replace(/-+(.)?/g, function(match, character){
153
+ return character ? character.toUpperCase() : '';
154
+ });
155
+ };
156
+
157
+ Parallax.prototype.transformSupport = function(value) {
158
+ var element = document.createElement('div');
159
+ var propertySupport = false;
160
+ var propertyValue = null;
161
+ var featureSupport = false;
162
+ var cssProperty = null;
163
+ var jsProperty = null;
164
+ for (var i = 0, l = this.vendors.length; i < l; i++) {
165
+ if (this.vendors[i] !== null) {
166
+ cssProperty = this.vendors[i][0] + 'transform';
167
+ jsProperty = this.vendors[i][1] + 'Transform';
168
+ } else {
169
+ cssProperty = 'transform';
170
+ jsProperty = 'transform';
171
+ }
172
+ if (element.style[jsProperty] !== undefined) {
173
+ propertySupport = true;
174
+ break;
175
+ }
176
+ }
177
+ switch(value) {
178
+ case '2D':
179
+ featureSupport = propertySupport;
180
+ break;
181
+ case '3D':
182
+ if (propertySupport) {
183
+ var body = document.body || document.createElement('body');
184
+ var documentElement = document.documentElement;
185
+ var documentOverflow = documentElement.style.overflow;
186
+ var isCreatedBody = false;
187
+ if (!document.body) {
188
+ isCreatedBody = true;
189
+ documentElement.style.overflow = 'hidden';
190
+ documentElement.appendChild(body);
191
+ body.style.overflow = 'hidden';
192
+ body.style.background = '';
193
+ }
194
+ body.appendChild(element);
195
+ element.style[jsProperty] = 'translate3d(1px,1px,1px)';
196
+ propertyValue = window.getComputedStyle(element).getPropertyValue(cssProperty);
197
+ featureSupport = propertyValue !== undefined && propertyValue.length > 0 && propertyValue !== 'none';
198
+ documentElement.style.overflow = documentOverflow;
199
+ body.removeChild(element);
200
+ if ( isCreatedBody ) {
201
+ body.removeAttribute('style');
202
+ body.parentNode.removeChild(body);
203
+ }
204
+ }
205
+ break;
206
+ }
207
+ return featureSupport;
208
+ };
209
+
210
+ Parallax.prototype.ww = null;
211
+ Parallax.prototype.wh = null;
212
+ Parallax.prototype.wcx = null;
213
+ Parallax.prototype.wcy = null;
214
+ Parallax.prototype.wrx = null;
215
+ Parallax.prototype.wry = null;
216
+ Parallax.prototype.portrait = null;
217
+ Parallax.prototype.desktop = !navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|BB10|mobi|tablet|opera mini|nexus 7)/i);
218
+ Parallax.prototype.vendors = [null,['-webkit-','webkit'],['-moz-','Moz'],['-o-','O'],['-ms-','ms']];
219
+ Parallax.prototype.motionSupport = !!window.DeviceMotionEvent;
220
+ Parallax.prototype.orientationSupport = !!window.DeviceOrientationEvent;
221
+ Parallax.prototype.orientationStatus = 0;
222
+ Parallax.prototype.motionStatus = 0;
223
+ Parallax.prototype.propertyCache = {};
224
+
225
+ Parallax.prototype.initialise = function() {
226
+
227
+ if (Parallax.prototype.transform2DSupport === undefined) {
228
+ Parallax.prototype.transform2DSupport = Parallax.prototype.transformSupport('2D');
229
+ Parallax.prototype.transform3DSupport = Parallax.prototype.transformSupport('3D');
230
+ }
231
+
232
+ // Configure Context Styles
233
+ if (this.transform3DSupport) this.accelerate(this.element);
234
+ var style = window.getComputedStyle(this.element);
235
+ if (style.getPropertyValue('position') === 'static') {
236
+ this.element.style.position = 'relative';
237
+ }
238
+
239
+ // Pointer events
240
+ if(!this.pointerEvents){
241
+ this.element.style.pointerEvents = 'none';
242
+ }
243
+
244
+ // Setup
245
+ this.updateLayers();
246
+ this.updateDimensions();
247
+ this.enable();
248
+ this.queueCalibration(this.calibrationDelay);
249
+ };
250
+
251
+ Parallax.prototype.updateLayers = function() {
252
+
253
+ // Cache Layer Elements
254
+ this.layers = this.element.getElementsByClassName('layer');
255
+ this.depthsX = [];
256
+ this.depthsY = [];
257
+
258
+ // Configure Layer Styles
259
+ for (var i = 0, l = this.layers.length; i < l; i++) {
260
+ var layer = this.layers[i];
261
+ if (this.transform3DSupport) this.accelerate(layer);
262
+ layer.style.position = i ? 'absolute' : 'relative';
263
+ layer.style.display = 'block';
264
+ layer.style.left = 0;
265
+ layer.style.top = 0;
266
+
267
+ // Cache Layer Depth
268
+ //Graceful fallback on depth if depth-x or depth-y is absent
269
+ var depth = this.data(layer, 'depth') || 0;
270
+ this.depthsX.push(this.data(layer, 'depth-x') || depth);
271
+ this.depthsY.push(this.data(layer, 'depth-y') || depth);
272
+ }
273
+ };
274
+
275
+ Parallax.prototype.updateDimensions = function() {
276
+ this.ww = window.innerWidth;
277
+ this.wh = window.innerHeight;
278
+ this.wcx = this.ww * this.originX;
279
+ this.wcy = this.wh * this.originY;
280
+ this.wrx = Math.max(this.wcx, this.ww - this.wcx);
281
+ this.wry = Math.max(this.wcy, this.wh - this.wcy);
282
+ };
283
+
284
+ Parallax.prototype.updateBounds = function() {
285
+ this.bounds = this.element.getBoundingClientRect();
286
+ this.ex = this.bounds.left;
287
+ this.ey = this.bounds.top;
288
+ this.ew = this.bounds.width;
289
+ this.eh = this.bounds.height;
290
+ this.ecx = this.ew * this.originX;
291
+ this.ecy = this.eh * this.originY;
292
+ this.erx = Math.max(this.ecx, this.ew - this.ecx);
293
+ this.ery = Math.max(this.ecy, this.eh - this.ecy);
294
+ };
295
+
296
+ Parallax.prototype.queueCalibration = function(delay) {
297
+ clearTimeout(this.calibrationTimer);
298
+ this.calibrationTimer = setTimeout(this.onCalibrationTimer, delay);
299
+ };
300
+
301
+ Parallax.prototype.enable = function() {
302
+ if (!this.enabled) {
303
+ this.enabled = true;
304
+ if (!this.desktop && this.orientationSupport) {
305
+ this.portrait = null;
306
+ window.addEventListener('deviceorientation', this.onDeviceOrientation);
307
+ setTimeout(this.onOrientationTimer, this.supportDelay);
308
+ }
309
+ else if (!this.desktop && this.motionSupport) {
310
+ this.portrait = null;
311
+ window.addEventListener('devicemotion', this.onDeviceMotion);
312
+ setTimeout(this.onMotionTimer, this.supportDelay);
313
+ }
314
+ else {
315
+ this.cx = 0;
316
+ this.cy = 0;
317
+ this.portrait = false;
318
+ window.addEventListener('mousemove', this.onMouseMove);
319
+ }
320
+ window.addEventListener('resize', this.onWindowResize);
321
+ this.raf = requestAnimationFrame(this.onAnimationFrame);
322
+ }
323
+ };
324
+
325
+ Parallax.prototype.disable = function() {
326
+ if (this.enabled) {
327
+ this.enabled = false;
328
+ if (this.orientationSupport) {
329
+ window.removeEventListener('deviceorientation', this.onDeviceOrientation);
330
+ }
331
+ else if (this.motionSupport) {
332
+ window.removeEventListener('devicemotion', this.onDeviceMotion);
333
+ }
334
+ else {
335
+ window.removeEventListener('mousemove', this.onMouseMove);
336
+ }
337
+ window.removeEventListener('resize', this.onWindowResize);
338
+ cancelAnimationFrame(this.raf);
339
+ }
340
+ };
341
+
342
+ Parallax.prototype.calibrate = function(x, y) {
343
+ this.calibrateX = x === undefined ? this.calibrateX : x;
344
+ this.calibrateY = y === undefined ? this.calibrateY : y;
345
+ };
346
+
347
+ Parallax.prototype.invert = function(x, y) {
348
+ this.invertX = x === undefined ? this.invertX : x;
349
+ this.invertY = y === undefined ? this.invertY : y;
350
+ };
351
+
352
+ Parallax.prototype.friction = function(x, y) {
353
+ this.frictionX = x === undefined ? this.frictionX : x;
354
+ this.frictionY = y === undefined ? this.frictionY : y;
355
+ };
356
+
357
+ Parallax.prototype.scalar = function(x, y) {
358
+ this.scalarX = x === undefined ? this.scalarX : x;
359
+ this.scalarY = y === undefined ? this.scalarY : y;
360
+ };
361
+
362
+ Parallax.prototype.limit = function(x, y) {
363
+ this.limitX = x === undefined ? this.limitX : x;
364
+ this.limitY = y === undefined ? this.limitY : y;
365
+ };
366
+
367
+ Parallax.prototype.origin = function(x, y) {
368
+ this.originX = x === undefined ? this.originX : x;
369
+ this.originY = y === undefined ? this.originY : y;
370
+ };
371
+
372
+ Parallax.prototype.clamp = function(value, min, max) {
373
+ value = Math.max(value, min);
374
+ value = Math.min(value, max);
375
+ return value;
376
+ };
377
+
378
+ Parallax.prototype.css = function(element, property, value) {
379
+ var jsProperty = this.propertyCache[property];
380
+ if (!jsProperty) {
381
+ for (var i = 0, l = this.vendors.length; i < l; i++) {
382
+ if (this.vendors[i] !== null) {
383
+ jsProperty = this.camelCase(this.vendors[i][1] + '-' + property);
384
+ } else {
385
+ jsProperty = property;
386
+ }
387
+ if (element.style[jsProperty] !== undefined) {
388
+ this.propertyCache[property] = jsProperty;
389
+ break;
390
+ }
391
+ }
392
+ }
393
+ element.style[jsProperty] = value;
394
+ };
395
+
396
+ Parallax.prototype.accelerate = function(element) {
397
+ this.css(element, 'transform', 'translate3d(0,0,0) rotate(0.0001deg)');
398
+ this.css(element, 'transform-style', 'preserve-3d');
399
+ this.css(element, 'backface-visibility', 'hidden');
400
+ };
401
+
402
+ Parallax.prototype.setPosition = function(element, x, y) {
403
+ x = x.toFixed(this.precision) + 'px';
404
+ y = y.toFixed(this.precision) + 'px';
405
+ if (this.transform3DSupport) {
406
+ this.css(element, 'transform', 'translate3d('+x+','+y+',0)');
407
+ } else if (this.transform2DSupport) {
408
+ this.css(element, 'transform', 'translate('+x+','+y+')');
409
+ } else {
410
+ element.style.left = x;
411
+ element.style.top = y;
412
+ }
413
+ };
414
+
415
+ Parallax.prototype.onOrientationTimer = function() {
416
+ if (this.orientationSupport && this.orientationStatus === 0) {
417
+ this.disable();
418
+ this.orientationSupport = false;
419
+ this.enable();
420
+ }
421
+ };
422
+
423
+ Parallax.prototype.onMotionTimer = function() {
424
+ if (this.motionSupport && this.motionStatus === 0) {
425
+ this.disable();
426
+ this.motionSupport = false;
427
+ this.enable();
428
+ }
429
+ };
430
+
431
+ Parallax.prototype.onCalibrationTimer = function() {
432
+ this.calibrationFlag = true;
433
+ };
434
+
435
+ Parallax.prototype.onWindowResize = function() {
436
+ this.updateDimensions();
437
+ };
438
+
439
+ Parallax.prototype.onAnimationFrame = function() {
440
+ this.updateBounds();
441
+ var dx = this.ix - this.cx;
442
+ var dy = this.iy - this.cy;
443
+ if ((Math.abs(dx) > this.calibrationThreshold) || (Math.abs(dy) > this.calibrationThreshold)) {
444
+ this.queueCalibration(0);
445
+ }
446
+ if (this.portrait) {
447
+ this.mx = this.calibrateX ? dy : this.iy;
448
+ this.my = this.calibrateY ? dx : this.ix;
449
+ } else {
450
+ this.mx = this.calibrateX ? dx : this.ix;
451
+ this.my = this.calibrateY ? dy : this.iy;
452
+ }
453
+ this.mx *= this.ew * (this.scalarX / 100);
454
+ this.my *= this.eh * (this.scalarY / 100);
455
+ if (!isNaN(parseFloat(this.limitX))) {
456
+ this.mx = this.clamp(this.mx, -this.limitX, this.limitX);
457
+ }
458
+ if (!isNaN(parseFloat(this.limitY))) {
459
+ this.my = this.clamp(this.my, -this.limitY, this.limitY);
460
+ }
461
+ this.vx += (this.mx - this.vx) * this.frictionX;
462
+ this.vy += (this.my - this.vy) * this.frictionY;
463
+ for (var i = 0, l = this.layers.length; i < l; i++) {
464
+ var layer = this.layers[i];
465
+ var depthX = this.depthsX[i];
466
+ var depthY = this.depthsY[i];
467
+ var xOffset = this.vx * (depthX * (this.invertX ? -1 : 1));
468
+ var yOffset = this.vy * (depthY * (this.invertY ? -1 : 1));
469
+ this.setPosition(layer, xOffset, yOffset);
470
+ }
471
+ this.raf = requestAnimationFrame(this.onAnimationFrame);
472
+ };
473
+
474
+ Parallax.prototype.rotate = function(beta,gamma){
475
+ // Extract Rotation
476
+ var x = (event.beta || 0) / MAGIC_NUMBER; // -90 :: 90
477
+ var y = (event.gamma || 0) / MAGIC_NUMBER; // -180 :: 180
478
+
479
+ // Detect Orientation Change
480
+ var portrait = this.wh > this.ww;
481
+ if (this.portrait !== portrait) {
482
+ this.portrait = portrait;
483
+ this.calibrationFlag = true;
484
+ }
485
+
486
+ // Set Calibration
487
+ if (this.calibrationFlag) {
488
+ this.calibrationFlag = false;
489
+ this.cx = x;
490
+ this.cy = y;
491
+ }
492
+
493
+ // Set Input
494
+ this.ix = x;
495
+ this.iy = y;
496
+ }
497
+ Parallax.prototype.onDeviceOrientation = function(event) {
498
+ // Validate environment and event properties.
499
+ var beta = event.beta;
500
+ var gamma = event.gamma;
501
+ if (!this.desktop && beta !== null && gamma !== null) {
502
+ // Set orientation status.
503
+ this.orientationStatus = 1;
504
+ this.rotate(beta,gamma);
505
+ }
506
+ };
507
+
508
+ Parallax.prototype.onDeviceMotion = function(event) {
509
+ // Validate environment and event properties.
510
+ var beta = event.rotationRate.beta;
511
+ var gamma = event.rotationRate.gamma;
512
+ if (!this.desktop && beta !== null && gamma !== null) {
513
+ // Set motion status.
514
+ this.motionStatus = 1;
515
+ this.rotate(beta,gamma);
516
+ }
517
+ };
518
+
519
+ Parallax.prototype.onMouseMove = function(event) {
520
+ // Cache mouse coordinates.
521
+ var clientX = event.clientX;
522
+ var clientY = event.clientY;
523
+
524
+ // Calculate Mouse Input
525
+ if (!this.orientationSupport && this.relativeInput) {
526
+
527
+ // Clip mouse coordinates inside element bounds.
528
+ if (this.clipRelativeInput) {
529
+ clientX = Math.max(clientX, this.ex);
530
+ clientX = Math.min(clientX, this.ex + this.ew);
531
+ clientY = Math.max(clientY, this.ey);
532
+ clientY = Math.min(clientY, this.ey + this.eh);
533
+ }
534
+
535
+ // Calculate input relative to the element.
536
+ this.ix = (clientX - this.ex - this.ecx) / this.erx;
537
+ this.iy = (clientY - this.ey - this.ecy) / this.ery;
538
+
539
+ } else {
540
+
541
+ // Calculate input relative to the window.
542
+ this.ix = (clientX - this.wcx) / this.wrx;
543
+ this.iy = (clientY - this.wcy) / this.wry;
544
+ }
545
+ };
546
+
547
+ // Expose Parallax
548
+ window[NAME] = Parallax;
549
+
550
+ })(window, document);