dr-jekylls-materials 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -0
  3. data/assets/css/materialize.scss +42 -0
  4. data/assets/css/site.css +10 -0
  5. data/assets/fonts/roboto/Roboto-Bold.eot +0 -0
  6. data/assets/fonts/roboto/Roboto-Bold.ttf +0 -0
  7. data/assets/fonts/roboto/Roboto-Bold.woff +0 -0
  8. data/assets/fonts/roboto/Roboto-Bold.woff2 +0 -0
  9. data/assets/fonts/roboto/Roboto-Light.eot +0 -0
  10. data/assets/fonts/roboto/Roboto-Light.ttf +0 -0
  11. data/assets/fonts/roboto/Roboto-Light.woff +0 -0
  12. data/assets/fonts/roboto/Roboto-Light.woff2 +0 -0
  13. data/assets/fonts/roboto/Roboto-Medium.eot +0 -0
  14. data/assets/fonts/roboto/Roboto-Medium.ttf +0 -0
  15. data/assets/fonts/roboto/Roboto-Medium.woff +0 -0
  16. data/assets/fonts/roboto/Roboto-Medium.woff2 +0 -0
  17. data/assets/fonts/roboto/Roboto-Regular.eot +0 -0
  18. data/assets/fonts/roboto/Roboto-Regular.ttf +0 -0
  19. data/assets/fonts/roboto/Roboto-Regular.woff +0 -0
  20. data/assets/fonts/roboto/Roboto-Regular.woff2 +0 -0
  21. data/assets/fonts/roboto/Roboto-Thin.eot +0 -0
  22. data/assets/fonts/roboto/Roboto-Thin.ttf +0 -0
  23. data/assets/fonts/roboto/Roboto-Thin.woff +0 -0
  24. data/assets/fonts/roboto/Roboto-Thin.woff2 +0 -0
  25. data/assets/js/animation.js +9 -0
  26. data/assets/js/bin/materialize.js +7778 -0
  27. data/assets/js/bin/materialize.min.js +10 -0
  28. data/assets/js/buttons.js +267 -0
  29. data/assets/js/cards.js +26 -0
  30. data/assets/js/carousel.js +454 -0
  31. data/assets/js/character_counter.js +72 -0
  32. data/assets/js/chips.js +289 -0
  33. data/assets/js/collapsible.js +160 -0
  34. data/assets/js/date_picker/picker.date.js +1430 -0
  35. data/assets/js/date_picker/picker.js +1123 -0
  36. data/assets/js/dropdown.js +265 -0
  37. data/assets/js/forms.js +682 -0
  38. data/assets/js/global.js +98 -0
  39. data/assets/js/hammer.min.js +1 -0
  40. data/assets/js/initial.js +11 -0
  41. data/assets/js/jquery.easing.1.3.js +205 -0
  42. data/assets/js/jquery.hammer.js +33 -0
  43. data/assets/js/materialbox.js +269 -0
  44. data/assets/js/materialize-readies.js +14 -0
  45. data/assets/js/materialize.js +7779 -0
  46. data/assets/js/materialize.min.js +10 -0
  47. data/assets/js/modal.js +184 -0
  48. data/assets/js/parallax.js +58 -0
  49. data/assets/js/pushpin.js +71 -0
  50. data/assets/js/scrollFire.js +48 -0
  51. data/assets/js/scrollspy.js +284 -0
  52. data/assets/js/sideNav.js +370 -0
  53. data/assets/js/slider.js +321 -0
  54. data/assets/js/tabs.js +164 -0
  55. data/assets/js/toasts.js +137 -0
  56. data/assets/js/tooltip.js +236 -0
  57. data/assets/js/transitions.js +169 -0
  58. data/assets/js/velocity.min.js +5 -0
  59. data/assets/js/waves.js +338 -0
  60. data/assets/materialize-LICENSE +21 -0
  61. data/assets/materialize-README.md +48 -0
  62. data/assets/site.css +2 -0
  63. metadata +61 -1
@@ -0,0 +1,370 @@
1
+ (function ($) {
2
+
3
+ var methods = {
4
+ init : function(options) {
5
+ var defaults = {
6
+ menuWidth: 300,
7
+ edge: 'left',
8
+ closeOnClick: false,
9
+ draggable: true
10
+ };
11
+ options = $.extend(defaults, options);
12
+
13
+ $(this).each(function(){
14
+ var $this = $(this);
15
+ var menu_id = $("#"+ $this.attr('data-activates'));
16
+
17
+ // Set to width
18
+ if (options.menuWidth != 300) {
19
+ menu_id.css('width', options.menuWidth);
20
+ }
21
+
22
+ // Add Touch Area
23
+ var $dragTarget;
24
+ if (options.draggable) {
25
+ $dragTarget = $('<div class="drag-target"></div>').attr('data-sidenav', $this.attr('data-activates'));
26
+ $('body').append($dragTarget);
27
+ } else {
28
+ $dragTarget = $();
29
+ }
30
+
31
+ if (options.edge == 'left') {
32
+ menu_id.css('transform', 'translateX(-100%)');
33
+ $dragTarget.css({'left': 0}); // Add Touch Area
34
+ }
35
+ else {
36
+ menu_id.addClass('right-aligned') // Change text-alignment to right
37
+ .css('transform', 'translateX(100%)');
38
+ $dragTarget.css({'right': 0}); // Add Touch Area
39
+ }
40
+
41
+ // If fixed sidenav, bring menu out
42
+ if (menu_id.hasClass('fixed')) {
43
+ if (window.innerWidth > 992) {
44
+ menu_id.css('transform', 'translateX(0)');
45
+ }
46
+ }
47
+
48
+ // Window resize to reset on large screens fixed
49
+ if (menu_id.hasClass('fixed')) {
50
+ $(window).resize( function() {
51
+ if (window.innerWidth > 992) {
52
+ // Close menu if window is resized bigger than 992 and user has fixed sidenav
53
+ if ($('#sidenav-overlay').length !== 0 && menuOut) {
54
+ removeMenu(true);
55
+ }
56
+ else {
57
+ // menu_id.removeAttr('style');
58
+ menu_id.css('transform', 'translateX(0%)');
59
+ // menu_id.css('width', options.menuWidth);
60
+ }
61
+ }
62
+ else if (menuOut === false){
63
+ if (options.edge === 'left') {
64
+ menu_id.css('transform', 'translateX(-100%)');
65
+ } else {
66
+ menu_id.css('transform', 'translateX(100%)');
67
+ }
68
+
69
+ }
70
+
71
+ });
72
+ }
73
+
74
+ // if closeOnClick, then add close event for all a tags in side sideNav
75
+ if (options.closeOnClick === true) {
76
+ menu_id.on("click.itemclick", "a:not(.collapsible-header)", function(){
77
+ removeMenu();
78
+ });
79
+ }
80
+
81
+ var removeMenu = function(restoreNav) {
82
+ panning = false;
83
+ menuOut = false;
84
+ // Reenable scrolling
85
+ $('body').css({
86
+ overflow: '',
87
+ width: ''
88
+ });
89
+
90
+ $('#sidenav-overlay').velocity({opacity: 0}, {duration: 200,
91
+ queue: false, easing: 'easeOutQuad',
92
+ complete: function() {
93
+ $(this).remove();
94
+ } });
95
+ if (options.edge === 'left') {
96
+ // Reset phantom div
97
+ $dragTarget.css({width: '', right: '', left: '0'});
98
+ menu_id.velocity(
99
+ {'translateX': '-100%'},
100
+ { duration: 200,
101
+ queue: false,
102
+ easing: 'easeOutCubic',
103
+ complete: function() {
104
+ if (restoreNav === true) {
105
+ // Restore Fixed sidenav
106
+ menu_id.removeAttr('style');
107
+ menu_id.css('width', options.menuWidth);
108
+ }
109
+ }
110
+
111
+ });
112
+ }
113
+ else {
114
+ // Reset phantom div
115
+ $dragTarget.css({width: '', right: '0', left: ''});
116
+ menu_id.velocity(
117
+ {'translateX': '100%'},
118
+ { duration: 200,
119
+ queue: false,
120
+ easing: 'easeOutCubic',
121
+ complete: function() {
122
+ if (restoreNav === true) {
123
+ // Restore Fixed sidenav
124
+ menu_id.removeAttr('style');
125
+ menu_id.css('width', options.menuWidth);
126
+ }
127
+ }
128
+ });
129
+ }
130
+ };
131
+
132
+
133
+
134
+ // Touch Event
135
+ var panning = false;
136
+ var menuOut = false;
137
+
138
+ if (options.draggable) {
139
+ $dragTarget.on('click', function(){
140
+ if (menuOut) {
141
+ removeMenu();
142
+ }
143
+ });
144
+
145
+ $dragTarget.hammer({
146
+ prevent_default: false
147
+ }).bind('pan', function(e) {
148
+
149
+ if (e.gesture.pointerType == "touch") {
150
+
151
+ var direction = e.gesture.direction;
152
+ var x = e.gesture.center.x;
153
+ var y = e.gesture.center.y;
154
+ var velocityX = e.gesture.velocityX;
155
+
156
+ // Disable Scrolling
157
+ var $body = $('body');
158
+ var $overlay = $('#sidenav-overlay');
159
+ var oldWidth = $body.innerWidth();
160
+ $body.css('overflow', 'hidden');
161
+ $body.width(oldWidth);
162
+
163
+ // If overlay does not exist, create one and if it is clicked, close menu
164
+ if ($overlay.length === 0) {
165
+ $overlay = $('<div id="sidenav-overlay"></div>');
166
+ $overlay.css('opacity', 0).click( function(){
167
+ removeMenu();
168
+ });
169
+ $('body').append($overlay);
170
+ }
171
+
172
+ // Keep within boundaries
173
+ if (options.edge === 'left') {
174
+ if (x > options.menuWidth) { x = options.menuWidth; }
175
+ else if (x < 0) { x = 0; }
176
+ }
177
+
178
+ if (options.edge === 'left') {
179
+ // Left Direction
180
+ if (x < (options.menuWidth / 2)) { menuOut = false; }
181
+ // Right Direction
182
+ else if (x >= (options.menuWidth / 2)) { menuOut = true; }
183
+ menu_id.css('transform', 'translateX(' + (x - options.menuWidth) + 'px)');
184
+ }
185
+ else {
186
+ // Left Direction
187
+ if (x < (window.innerWidth - options.menuWidth / 2)) {
188
+ menuOut = true;
189
+ }
190
+ // Right Direction
191
+ else if (x >= (window.innerWidth - options.menuWidth / 2)) {
192
+ menuOut = false;
193
+ }
194
+ var rightPos = (x - options.menuWidth / 2);
195
+ if (rightPos < 0) {
196
+ rightPos = 0;
197
+ }
198
+
199
+ menu_id.css('transform', 'translateX(' + rightPos + 'px)');
200
+ }
201
+
202
+
203
+ // Percentage overlay
204
+ var overlayPerc;
205
+ if (options.edge === 'left') {
206
+ overlayPerc = x / options.menuWidth;
207
+ $overlay.velocity({opacity: overlayPerc }, {duration: 10, queue: false, easing: 'easeOutQuad'});
208
+ }
209
+ else {
210
+ overlayPerc = Math.abs((x - window.innerWidth) / options.menuWidth);
211
+ $overlay.velocity({opacity: overlayPerc }, {duration: 10, queue: false, easing: 'easeOutQuad'});
212
+ }
213
+ }
214
+
215
+ }).bind('panend', function(e) {
216
+
217
+ if (e.gesture.pointerType == "touch") {
218
+ var $overlay = $('<div id="sidenav-overlay"></div>');
219
+ var velocityX = e.gesture.velocityX;
220
+ var x = e.gesture.center.x;
221
+ var leftPos = x - options.menuWidth;
222
+ var rightPos = x - options.menuWidth / 2;
223
+ if (leftPos > 0 ) {
224
+ leftPos = 0;
225
+ }
226
+ if (rightPos < 0) {
227
+ rightPos = 0;
228
+ }
229
+ panning = false;
230
+
231
+ if (options.edge === 'left') {
232
+ // If velocityX <= 0.3 then the user is flinging the menu closed so ignore menuOut
233
+ if ((menuOut && velocityX <= 0.3) || velocityX < -0.5) {
234
+ // Return menu to open
235
+ if (leftPos !== 0) {
236
+ menu_id.velocity({'translateX': [0, leftPos]}, {duration: 300, queue: false, easing: 'easeOutQuad'});
237
+ }
238
+
239
+ $overlay.velocity({opacity: 1 }, {duration: 50, queue: false, easing: 'easeOutQuad'});
240
+ $dragTarget.css({width: '50%', right: 0, left: ''});
241
+ menuOut = true;
242
+ }
243
+ else if (!menuOut || velocityX > 0.3) {
244
+ // Enable Scrolling
245
+ $('body').css({
246
+ overflow: '',
247
+ width: ''
248
+ });
249
+ // Slide menu closed
250
+ menu_id.velocity({'translateX': [-1 * options.menuWidth - 10, leftPos]}, {duration: 200, queue: false, easing: 'easeOutQuad'});
251
+ $overlay.velocity({opacity: 0 }, {duration: 200, queue: false, easing: 'easeOutQuad',
252
+ complete: function () {
253
+ $(this).remove();
254
+ }});
255
+ $dragTarget.css({width: '10px', right: '', left: 0});
256
+ }
257
+ }
258
+ else {
259
+ if ((menuOut && velocityX >= -0.3) || velocityX > 0.5) {
260
+ // Return menu to open
261
+ if (rightPos !== 0) {
262
+ menu_id.velocity({'translateX': [0, rightPos]}, {duration: 300, queue: false, easing: 'easeOutQuad'});
263
+ }
264
+
265
+ $overlay.velocity({opacity: 1 }, {duration: 50, queue: false, easing: 'easeOutQuad'});
266
+ $dragTarget.css({width: '50%', right: '', left: 0});
267
+ menuOut = true;
268
+ }
269
+ else if (!menuOut || velocityX < -0.3) {
270
+ // Enable Scrolling
271
+ $('body').css({
272
+ overflow: '',
273
+ width: ''
274
+ });
275
+
276
+ // Slide menu closed
277
+ menu_id.velocity({'translateX': [options.menuWidth + 10, rightPos]}, {duration: 200, queue: false, easing: 'easeOutQuad'});
278
+ $overlay.velocity({opacity: 0 }, {duration: 200, queue: false, easing: 'easeOutQuad',
279
+ complete: function () {
280
+ $(this).remove();
281
+ }});
282
+ $dragTarget.css({width: '10px', right: 0, left: ''});
283
+ }
284
+ }
285
+
286
+ }
287
+ });
288
+ }
289
+
290
+ $this.click(function() {
291
+ if (menuOut === true) {
292
+ menuOut = false;
293
+ panning = false;
294
+ removeMenu();
295
+ }
296
+ else {
297
+
298
+ // Disable Scrolling
299
+ var $body = $('body');
300
+ var $overlay = $('<div id="sidenav-overlay"></div>');
301
+ var oldWidth = $body.innerWidth();
302
+ $body.css('overflow', 'hidden');
303
+ $body.width(oldWidth);
304
+
305
+ // Push current drag target on top of DOM tree
306
+ $('body').append($dragTarget);
307
+
308
+ if (options.edge === 'left') {
309
+ $dragTarget.css({width: '50%', right: 0, left: ''});
310
+ menu_id.velocity({'translateX': [0, -1 * options.menuWidth]}, {duration: 300, queue: false, easing: 'easeOutQuad'});
311
+ }
312
+ else {
313
+ $dragTarget.css({width: '50%', right: '', left: 0});
314
+ menu_id.velocity({'translateX': [0, options.menuWidth]}, {duration: 300, queue: false, easing: 'easeOutQuad'});
315
+ }
316
+
317
+ $overlay.css('opacity', 0)
318
+ .click(function(){
319
+ menuOut = false;
320
+ panning = false;
321
+ removeMenu();
322
+ $overlay.velocity({opacity: 0}, {duration: 300, queue: false, easing: 'easeOutQuad',
323
+ complete: function() {
324
+ $(this).remove();
325
+ } });
326
+
327
+ });
328
+ $('body').append($overlay);
329
+ $overlay.velocity({opacity: 1}, {duration: 300, queue: false, easing: 'easeOutQuad',
330
+ complete: function () {
331
+ menuOut = true;
332
+ panning = false;
333
+ }
334
+ });
335
+ }
336
+
337
+ return false;
338
+ });
339
+ });
340
+
341
+
342
+ },
343
+ destroy: function () {
344
+ var $overlay = $('#sidenav-overlay');
345
+ var $dragTarget = $('.drag-target[data-sidenav="' + $(this).attr('data-activates') + '"]');
346
+ $overlay.trigger('click');
347
+ $dragTarget.remove();
348
+ $(this).off('click');
349
+ $overlay.remove();
350
+ },
351
+ show : function() {
352
+ this.trigger('click');
353
+ },
354
+ hide : function() {
355
+ $('#sidenav-overlay').trigger('click');
356
+ }
357
+ };
358
+
359
+
360
+ $.fn.sideNav = function(methodOrOptions) {
361
+ if ( methods[methodOrOptions] ) {
362
+ return methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));
363
+ } else if ( typeof methodOrOptions === 'object' || ! methodOrOptions ) {
364
+ // Default to "init"
365
+ return methods.init.apply( this, arguments );
366
+ } else {
367
+ $.error( 'Method ' + methodOrOptions + ' does not exist on jQuery.sideNav' );
368
+ }
369
+ }; // Plugin end
370
+ }( jQuery ));
@@ -0,0 +1,321 @@
1
+ (function ($) {
2
+
3
+ var methods = {
4
+
5
+ init : function(options) {
6
+ var defaults = {
7
+ indicators: true,
8
+ height: 400,
9
+ transition: 500,
10
+ interval: 6000
11
+ };
12
+ options = $.extend(defaults, options);
13
+
14
+ return this.each(function() {
15
+
16
+ // For each slider, we want to keep track of
17
+ // which slide is active and its associated content
18
+ var $this = $(this);
19
+ var $slider = $this.find('ul.slides').first();
20
+ var $slides = $slider.find('> li');
21
+ var $active_index = $slider.find('.active').index();
22
+ var $active, $indicators, $interval;
23
+ if ($active_index != -1) { $active = $slides.eq($active_index); }
24
+
25
+ // Transitions the caption depending on alignment
26
+ function captionTransition(caption, duration) {
27
+ if (caption.hasClass("center-align")) {
28
+ caption.velocity({opacity: 0, translateY: -100}, {duration: duration, queue: false});
29
+ }
30
+ else if (caption.hasClass("right-align")) {
31
+ caption.velocity({opacity: 0, translateX: 100}, {duration: duration, queue: false});
32
+ }
33
+ else if (caption.hasClass("left-align")) {
34
+ caption.velocity({opacity: 0, translateX: -100}, {duration: duration, queue: false});
35
+ }
36
+ }
37
+
38
+ // This function will transition the slide to any index of the next slide
39
+ function moveToSlide(index) {
40
+ // Wrap around indices.
41
+ if (index >= $slides.length) index = 0;
42
+ else if (index < 0) index = $slides.length -1;
43
+
44
+ $active_index = $slider.find('.active').index();
45
+
46
+ // Only do if index changes
47
+ if ($active_index != index) {
48
+ $active = $slides.eq($active_index);
49
+ $caption = $active.find('.caption');
50
+
51
+ $active.removeClass('active');
52
+ $active.velocity({opacity: 0}, {duration: options.transition, queue: false, easing: 'easeOutQuad',
53
+ complete: function() {
54
+ $slides.not('.active').velocity({opacity: 0, translateX: 0, translateY: 0}, {duration: 0, queue: false});
55
+ } });
56
+ captionTransition($caption, options.transition);
57
+
58
+
59
+ // Update indicators
60
+ if (options.indicators) {
61
+ $indicators.eq($active_index).removeClass('active');
62
+ }
63
+
64
+ $slides.eq(index).velocity({opacity: 1}, {duration: options.transition, queue: false, easing: 'easeOutQuad'});
65
+ $slides.eq(index).find('.caption').velocity({opacity: 1, translateX: 0, translateY: 0}, {duration: options.transition, delay: options.transition, queue: false, easing: 'easeOutQuad'});
66
+ $slides.eq(index).addClass('active');
67
+
68
+
69
+ // Update indicators
70
+ if (options.indicators) {
71
+ $indicators.eq(index).addClass('active');
72
+ }
73
+ }
74
+ }
75
+
76
+ // Set height of slider
77
+ // If fullscreen, do nothing
78
+ if (!$this.hasClass('fullscreen')) {
79
+ if (options.indicators) {
80
+ // Add height if indicators are present
81
+ $this.height(options.height + 40);
82
+ }
83
+ else {
84
+ $this.height(options.height);
85
+ }
86
+ $slider.height(options.height);
87
+ }
88
+
89
+
90
+ // Set initial positions of captions
91
+ $slides.find('.caption').each(function () {
92
+ captionTransition($(this), 0);
93
+ });
94
+
95
+ // Move img src into background-image
96
+ $slides.find('img').each(function () {
97
+ var placeholderBase64 = 'data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
98
+ if ($(this).attr('src') !== placeholderBase64) {
99
+ $(this).css('background-image', 'url(' + $(this).attr('src') + ')' );
100
+ $(this).attr('src', placeholderBase64);
101
+ }
102
+ });
103
+
104
+ // dynamically add indicators
105
+ if (options.indicators) {
106
+ $indicators = $('<ul class="indicators"></ul>');
107
+ $slides.each(function( index ) {
108
+ var $indicator = $('<li class="indicator-item"></li>');
109
+
110
+ // Handle clicks on indicators
111
+ $indicator.click(function () {
112
+ var $parent = $slider.parent();
113
+ var curr_index = $parent.find($(this)).index();
114
+ moveToSlide(curr_index);
115
+
116
+ // reset interval
117
+ clearInterval($interval);
118
+ $interval = setInterval(
119
+ function(){
120
+ $active_index = $slider.find('.active').index();
121
+ if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
122
+ else $active_index += 1;
123
+
124
+ moveToSlide($active_index);
125
+
126
+ }, options.transition + options.interval
127
+ );
128
+ });
129
+ $indicators.append($indicator);
130
+ });
131
+ $this.append($indicators);
132
+ $indicators = $this.find('ul.indicators').find('li.indicator-item');
133
+ }
134
+
135
+ if ($active) {
136
+ $active.show();
137
+ }
138
+ else {
139
+ $slides.first().addClass('active').velocity({opacity: 1}, {duration: options.transition, queue: false, easing: 'easeOutQuad'});
140
+
141
+ $active_index = 0;
142
+ $active = $slides.eq($active_index);
143
+
144
+ // Update indicators
145
+ if (options.indicators) {
146
+ $indicators.eq($active_index).addClass('active');
147
+ }
148
+ }
149
+
150
+ // Adjust height to current slide
151
+ $active.find('img').each(function() {
152
+ $active.find('.caption').velocity({opacity: 1, translateX: 0, translateY: 0}, {duration: options.transition, queue: false, easing: 'easeOutQuad'});
153
+ });
154
+
155
+ // auto scroll
156
+ $interval = setInterval(
157
+ function(){
158
+ $active_index = $slider.find('.active').index();
159
+ moveToSlide($active_index + 1);
160
+
161
+ }, options.transition + options.interval
162
+ );
163
+
164
+
165
+ // HammerJS, Swipe navigation
166
+
167
+ // Touch Event
168
+ var panning = false;
169
+ var swipeLeft = false;
170
+ var swipeRight = false;
171
+
172
+ $this.hammer({
173
+ prevent_default: false
174
+ }).bind('pan', function(e) {
175
+ if (e.gesture.pointerType === "touch") {
176
+
177
+ // reset interval
178
+ clearInterval($interval);
179
+
180
+ var direction = e.gesture.direction;
181
+ var x = e.gesture.deltaX;
182
+ var velocityX = e.gesture.velocityX;
183
+
184
+ $curr_slide = $slider.find('.active');
185
+ $curr_slide.velocity({ translateX: x
186
+ }, {duration: 50, queue: false, easing: 'easeOutQuad'});
187
+
188
+ // Swipe Left
189
+ if (direction === 4 && (x > ($this.innerWidth() / 2) || velocityX < -0.65)) {
190
+ swipeRight = true;
191
+ }
192
+ // Swipe Right
193
+ else if (direction === 2 && (x < (-1 * $this.innerWidth() / 2) || velocityX > 0.65)) {
194
+ swipeLeft = true;
195
+ }
196
+
197
+ // Make Slide Behind active slide visible
198
+ var next_slide;
199
+ if (swipeLeft) {
200
+ next_slide = $curr_slide.next();
201
+ if (next_slide.length === 0) {
202
+ next_slide = $slides.first();
203
+ }
204
+ next_slide.velocity({ opacity: 1
205
+ }, {duration: 300, queue: false, easing: 'easeOutQuad'});
206
+ }
207
+ if (swipeRight) {
208
+ next_slide = $curr_slide.prev();
209
+ if (next_slide.length === 0) {
210
+ next_slide = $slides.last();
211
+ }
212
+ next_slide.velocity({ opacity: 1
213
+ }, {duration: 300, queue: false, easing: 'easeOutQuad'});
214
+ }
215
+
216
+
217
+ }
218
+
219
+ }).bind('panend', function(e) {
220
+ if (e.gesture.pointerType === "touch") {
221
+
222
+ $curr_slide = $slider.find('.active');
223
+ panning = false;
224
+ curr_index = $slider.find('.active').index();
225
+
226
+ if (!swipeRight && !swipeLeft || $slides.length <=1) {
227
+ // Return to original spot
228
+ $curr_slide.velocity({ translateX: 0
229
+ }, {duration: 300, queue: false, easing: 'easeOutQuad'});
230
+ }
231
+ else if (swipeLeft) {
232
+ moveToSlide(curr_index + 1);
233
+ $curr_slide.velocity({translateX: -1 * $this.innerWidth() }, {duration: 300, queue: false, easing: 'easeOutQuad',
234
+ complete: function() {
235
+ $curr_slide.velocity({opacity: 0, translateX: 0}, {duration: 0, queue: false});
236
+ } });
237
+ }
238
+ else if (swipeRight) {
239
+ moveToSlide(curr_index - 1);
240
+ $curr_slide.velocity({translateX: $this.innerWidth() }, {duration: 300, queue: false, easing: 'easeOutQuad',
241
+ complete: function() {
242
+ $curr_slide.velocity({opacity: 0, translateX: 0}, {duration: 0, queue: false});
243
+ } });
244
+ }
245
+ swipeLeft = false;
246
+ swipeRight = false;
247
+
248
+ // Restart interval
249
+ clearInterval($interval);
250
+ $interval = setInterval(
251
+ function(){
252
+ $active_index = $slider.find('.active').index();
253
+ if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
254
+ else $active_index += 1;
255
+
256
+ moveToSlide($active_index);
257
+
258
+ }, options.transition + options.interval
259
+ );
260
+ }
261
+ });
262
+
263
+ $this.on('sliderPause', function() {
264
+ clearInterval($interval);
265
+ });
266
+
267
+ $this.on('sliderStart', function() {
268
+ clearInterval($interval);
269
+ $interval = setInterval(
270
+ function(){
271
+ $active_index = $slider.find('.active').index();
272
+ if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
273
+ else $active_index += 1;
274
+
275
+ moveToSlide($active_index);
276
+
277
+ }, options.transition + options.interval
278
+ );
279
+ });
280
+
281
+ $this.on('sliderNext', function() {
282
+ $active_index = $slider.find('.active').index();
283
+ moveToSlide($active_index + 1);
284
+ });
285
+
286
+ $this.on('sliderPrev', function() {
287
+ $active_index = $slider.find('.active').index();
288
+ moveToSlide($active_index - 1);
289
+ });
290
+
291
+ });
292
+
293
+
294
+
295
+ },
296
+ pause : function() {
297
+ $(this).trigger('sliderPause');
298
+ },
299
+ start : function() {
300
+ $(this).trigger('sliderStart');
301
+ },
302
+ next : function() {
303
+ $(this).trigger('sliderNext');
304
+ },
305
+ prev : function() {
306
+ $(this).trigger('sliderPrev');
307
+ }
308
+ };
309
+
310
+
311
+ $.fn.slider = function(methodOrOptions) {
312
+ if ( methods[methodOrOptions] ) {
313
+ return methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));
314
+ } else if ( typeof methodOrOptions === 'object' || ! methodOrOptions ) {
315
+ // Default to "init"
316
+ return methods.init.apply( this, arguments );
317
+ } else {
318
+ $.error( 'Method ' + methodOrOptions + ' does not exist on jQuery.tooltip' );
319
+ }
320
+ }; // Plugin end
321
+ }( jQuery ));