1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,103 +0,0 @@ |
1 |
-/*! |
|
2 |
-Waypoints Inview Shortcut - 3.1.1 |
|
3 |
-Copyright © 2011-2015 Caleb Troughton |
|
4 |
-Licensed under the MIT license. |
|
5 |
-https://github.com/imakewebthings/waypoints/blog/master/licenses.txt |
|
6 |
-*/ |
|
7 |
-(function() { |
|
8 |
- 'use strict' |
|
9 |
- |
|
10 |
- function noop() {} |
|
11 |
- |
|
12 |
- var Waypoint = window.Waypoint |
|
13 |
- |
|
14 |
- /* http://imakewebthings.com/waypoints/shortcuts/inview */ |
|
15 |
- function Inview(options) { |
|
16 |
- this.options = Waypoint.Adapter.extend({}, Inview.defaults, options) |
|
17 |
- this.axis = this.options.horizontal ? 'horizontal' : 'vertical' |
|
18 |
- this.waypoints = [] |
|
19 |
- this.createWaypoints() |
|
20 |
- } |
|
21 |
- |
|
22 |
- /* Private */ |
|
23 |
- Inview.prototype.createWaypoints = function() { |
|
24 |
- var configs = { |
|
25 |
- vertical: [{ |
|
26 |
- down: 'enter', |
|
27 |
- up: 'exited', |
|
28 |
- offset: '100%' |
|
29 |
- }, { |
|
30 |
- down: 'entered', |
|
31 |
- up: 'exit', |
|
32 |
- offset: 'bottom-in-view' |
|
33 |
- }, { |
|
34 |
- down: 'exit', |
|
35 |
- up: 'entered', |
|
36 |
- offset: 0 |
|
37 |
- }, { |
|
38 |
- down: 'exited', |
|
39 |
- up: 'enter', |
|
40 |
- offset: function() { |
|
41 |
- return -this.adapter.outerHeight() |
|
42 |
- } |
|
43 |
- }], |
|
44 |
- horizontal: [{ |
|
45 |
- right: 'enter', |
|
46 |
- left: 'exited', |
|
47 |
- offset: '100%' |
|
48 |
- }, { |
|
49 |
- right: 'entered', |
|
50 |
- left: 'exit', |
|
51 |
- offset: 'right-in-view' |
|
52 |
- }, { |
|
53 |
- right: 'exit', |
|
54 |
- left: 'entered', |
|
55 |
- offset: 0 |
|
56 |
- }, { |
|
57 |
- right: 'exited', |
|
58 |
- left: 'enter', |
|
59 |
- offset: function() { |
|
60 |
- return -this.adapter.outerWidth() |
|
61 |
- } |
|
62 |
- }] |
|
63 |
- } |
|
64 |
- |
|
65 |
- for (var i = 0, end = configs[this.axis].length; i < end; i++) { |
|
66 |
- var config = configs[this.axis][i] |
|
67 |
- this.createWaypoint(config) |
|
68 |
- } |
|
69 |
- } |
|
70 |
- |
|
71 |
- /* Private */ |
|
72 |
- Inview.prototype.createWaypoint = function(config) { |
|
73 |
- var self = this |
|
74 |
- this.waypoints.push(new Waypoint({ |
|
75 |
- element: this.options.element, |
|
76 |
- handler: (function(config) { |
|
77 |
- return function(direction) { |
|
78 |
- self.options[config[direction]].call(this, direction) |
|
79 |
- } |
|
80 |
- }(config)), |
|
81 |
- offset: config.offset, |
|
82 |
- horizontal: this.options.horizontal |
|
83 |
- })) |
|
84 |
- } |
|
85 |
- |
|
86 |
- /* Public */ |
|
87 |
- Inview.prototype.destroy = function() { |
|
88 |
- for (var i = 0, end = this.waypoints.length; i < end; i++) { |
|
89 |
- this.waypoints[i].destroy() |
|
90 |
- } |
|
91 |
- this.waypoints = [] |
|
92 |
- } |
|
93 |
- |
|
94 |
- Inview.defaults = { |
|
95 |
- enter: noop, |
|
96 |
- entered: noop, |
|
97 |
- exit: noop, |
|
98 |
- exited: noop |
|
99 |
- } |
|
100 |
- |
|
101 |
- Waypoint.Inview = Inview |
|
102 |
-}()) |
|
103 |
-; |
|
104 | 0 |
\ No newline at end of file |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,103 @@ |
1 |
+/*! |
|
2 |
+Waypoints Inview Shortcut - 3.1.1 |
|
3 |
+Copyright © 2011-2015 Caleb Troughton |
|
4 |
+Licensed under the MIT license. |
|
5 |
+https://github.com/imakewebthings/waypoints/blog/master/licenses.txt |
|
6 |
+*/ |
|
7 |
+(function() { |
|
8 |
+ 'use strict' |
|
9 |
+ |
|
10 |
+ function noop() {} |
|
11 |
+ |
|
12 |
+ var Waypoint = window.Waypoint |
|
13 |
+ |
|
14 |
+ /* http://imakewebthings.com/waypoints/shortcuts/inview */ |
|
15 |
+ function Inview(options) { |
|
16 |
+ this.options = Waypoint.Adapter.extend({}, Inview.defaults, options) |
|
17 |
+ this.axis = this.options.horizontal ? 'horizontal' : 'vertical' |
|
18 |
+ this.waypoints = [] |
|
19 |
+ this.createWaypoints() |
|
20 |
+ } |
|
21 |
+ |
|
22 |
+ /* Private */ |
|
23 |
+ Inview.prototype.createWaypoints = function() { |
|
24 |
+ var configs = { |
|
25 |
+ vertical: [{ |
|
26 |
+ down: 'enter', |
|
27 |
+ up: 'exited', |
|
28 |
+ offset: '100%' |
|
29 |
+ }, { |
|
30 |
+ down: 'entered', |
|
31 |
+ up: 'exit', |
|
32 |
+ offset: 'bottom-in-view' |
|
33 |
+ }, { |
|
34 |
+ down: 'exit', |
|
35 |
+ up: 'entered', |
|
36 |
+ offset: 0 |
|
37 |
+ }, { |
|
38 |
+ down: 'exited', |
|
39 |
+ up: 'enter', |
|
40 |
+ offset: function() { |
|
41 |
+ return -this.adapter.outerHeight() |
|
42 |
+ } |
|
43 |
+ }], |
|
44 |
+ horizontal: [{ |
|
45 |
+ right: 'enter', |
|
46 |
+ left: 'exited', |
|
47 |
+ offset: '100%' |
|
48 |
+ }, { |
|
49 |
+ right: 'entered', |
|
50 |
+ left: 'exit', |
|
51 |
+ offset: 'right-in-view' |
|
52 |
+ }, { |
|
53 |
+ right: 'exit', |
|
54 |
+ left: 'entered', |
|
55 |
+ offset: 0 |
|
56 |
+ }, { |
|
57 |
+ right: 'exited', |
|
58 |
+ left: 'enter', |
|
59 |
+ offset: function() { |
|
60 |
+ return -this.adapter.outerWidth() |
|
61 |
+ } |
|
62 |
+ }] |
|
63 |
+ } |
|
64 |
+ |
|
65 |
+ for (var i = 0, end = configs[this.axis].length; i < end; i++) { |
|
66 |
+ var config = configs[this.axis][i] |
|
67 |
+ this.createWaypoint(config) |
|
68 |
+ } |
|
69 |
+ } |
|
70 |
+ |
|
71 |
+ /* Private */ |
|
72 |
+ Inview.prototype.createWaypoint = function(config) { |
|
73 |
+ var self = this |
|
74 |
+ this.waypoints.push(new Waypoint({ |
|
75 |
+ element: this.options.element, |
|
76 |
+ handler: (function(config) { |
|
77 |
+ return function(direction) { |
|
78 |
+ self.options[config[direction]].call(this, direction) |
|
79 |
+ } |
|
80 |
+ }(config)), |
|
81 |
+ offset: config.offset, |
|
82 |
+ horizontal: this.options.horizontal |
|
83 |
+ })) |
|
84 |
+ } |
|
85 |
+ |
|
86 |
+ /* Public */ |
|
87 |
+ Inview.prototype.destroy = function() { |
|
88 |
+ for (var i = 0, end = this.waypoints.length; i < end; i++) { |
|
89 |
+ this.waypoints[i].destroy() |
|
90 |
+ } |
|
91 |
+ this.waypoints = [] |
|
92 |
+ } |
|
93 |
+ |
|
94 |
+ Inview.defaults = { |
|
95 |
+ enter: noop, |
|
96 |
+ entered: noop, |
|
97 |
+ exit: noop, |
|
98 |
+ exited: noop |
|
99 |
+ } |
|
100 |
+ |
|
101 |
+ Waypoint.Inview = Inview |
|
102 |
+}()) |
|
103 |
+; |
|
0 | 104 |
\ No newline at end of file |