scrollify 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 73440860e3fa737f32a73a9c39f85395cb749a35
4
+ data.tar.gz: cb3c37304631d066a9bfbcb60d90479cc596bd79
5
+ SHA512:
6
+ metadata.gz: 50447f435a36c6c42518e2094169eb772d8398d4aba7e202a4085b45020e62ed0794a8097a4d750f7dfbf20e8e40de58219ad6f823b07f0f51c2e244f8265b5f
7
+ data.tar.gz: 51d45c06bb8c6751f29d65f20ab866980ccea31b3f9bc5c9c76d35c8e75a65d713663c126a066724777bc660c319bc7f486bd458f25bbc14f4a7e0ea78bb1c50
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in scrollify.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Rahul Lakhaney
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,65 @@
1
+ # Scrollify
2
+
3
+ A ruby gem for scrollify plugin [developed by Luke Haas](http://lukehaas.me/).
4
+ A jQuery plugin that assists scrolling and snaps to sections. Touch optimised.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'scrollify'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install scrollify
21
+
22
+ ## Usage
23
+
24
+ To your ```application.js``` file, add:
25
+ ```Javascript
26
+ //= require scrollify
27
+ ```
28
+
29
+ This is all you need to get going with the scrolling and section snapping
30
+
31
+ ```HTML
32
+ <!doctype html>
33
+ <html>
34
+ <head>
35
+ <script>
36
+ $(function() {
37
+ $.scrollify({
38
+ section : "section",
39
+ });
40
+ });
41
+ </script>
42
+ </head>
43
+ <body>
44
+ <section></section>
45
+ <section></section>
46
+ </body>
47
+ </html>
48
+ ```
49
+
50
+ [Demo](http://projects.lukehaas.me/scrollify/#home)
51
+
52
+ ## Customizations
53
+
54
+ [Visit the official plugin github page for more details on customications](https://github.com/lukehaas/Scrollify/)
55
+
56
+
57
+ ## Contributing
58
+
59
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rahullakhaney/scrollify.
60
+
61
+
62
+ ## License
63
+
64
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
65
+
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "scrollify"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ require "scrollify/version"
2
+
3
+ module Scrollify
4
+ class Engine < ::Rails::Engine; end
5
+ end
@@ -0,0 +1,3 @@
1
+ module Scrollify
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'scrollify/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "scrollify"
8
+ spec.version = Scrollify::VERSION
9
+ spec.authors = ["Rahul Lakhaney"]
10
+ spec.email = ["rahul.lakhaney@gmail.com"]
11
+
12
+ spec.summary = %q{A jQuery plugin that assists scrolling and snaps to sections.}
13
+ spec.description = %q{Ruby gem for Luke Haas's scrollify jQuery plugin that assists scrolling and snaps to sections. Touch optimised.}
14
+ spec.homepage = "http://www.github.com/rahullakhaney/scrollify"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.10"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ end
@@ -0,0 +1,576 @@
1
+ /*!
2
+ * jQuery Scrollify
3
+ * Version 0.1.11
4
+ *
5
+ * Requires:
6
+ * - jQuery 1.6 or higher
7
+ *
8
+ * https://github.com/lukehaas/Scrollify
9
+ *
10
+ * Copyright 2015, Luke Haas
11
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
12
+ * this software and associated documentation files (the "Software"), to deal in
13
+ * the Software without restriction, including without limitation the rights to
14
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
15
+ * the Software, and to permit persons to whom the Software is furnished to do so,
16
+ * subject to the following conditions:
17
+ *
18
+ * The above copyright notice and this permission notice shall be included in all
19
+ * copies or substantial portions of the Software.
20
+ *
21
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
23
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
24
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
25
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
26
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
+ */
28
+ (function ($,window,document,undefined) {
29
+ "use strict";
30
+ var heights = [],
31
+ names = [],
32
+ elements = [],
33
+ overflow = [],
34
+ index = 0,
35
+ interstitialIndex = 1,
36
+ currentHash = window.location.hash,
37
+ hasLocation = false,
38
+ timeoutId,
39
+ timeoutId2,
40
+ top = $(window).scrollTop(),
41
+ scrollable = false,
42
+ locked = false,
43
+ scrolled = false,
44
+ manualScroll,
45
+ swipeScroll,
46
+ util,
47
+ disabled = false,
48
+ scrollSamples = [],
49
+ scrollTime = new Date().getTime(),
50
+ settings = {
51
+ //section should be an identifier that is the same for each section
52
+ section: "section",
53
+ sectionName: "section-name",
54
+ easing: "easeOutExpo",
55
+ scrollSpeed: 1100,
56
+ offset : 0,
57
+ scrollbars: true,
58
+ axis:"y",
59
+ target:"html,body",
60
+ before:function() {},
61
+ after:function() {},
62
+ afterResize:function() {}
63
+ };
64
+ function animateScroll(index,instant) {
65
+ if(disabled===true) {
66
+ return true;
67
+ }
68
+ if(names[index]) {
69
+ settings.before(index,elements);
70
+ interstitialIndex = 1;
71
+ if(settings.sectionName) {
72
+ window.location.hash = names[index];
73
+ }
74
+ if(instant) {
75
+ $(settings.target).stop().scrollTop(heights[index]);
76
+ settings.after(index,elements);
77
+ } else {
78
+ $(settings.target).stop().animate({
79
+ scrollTop: heights[index]
80
+ }, settings.scrollSpeed,settings.easing);
81
+
82
+ $(settings.target).promise().done(function(){locked = false;settings.after(index,elements);});
83
+ }
84
+
85
+ }
86
+ }
87
+
88
+ function isAccelerating(samples) {
89
+
90
+ if(samples<4) {
91
+ return false;
92
+ }
93
+ var limit = 20,sum = 0,i = samples.length-1,l;
94
+ if(samples.length<limit*2) {
95
+ limit = Math.floor(samples.length/2);
96
+ }
97
+ l = samples.length-limit;
98
+ for(;i>=l;i--) {
99
+ sum = sum+samples[i];
100
+ }
101
+ var average1 = sum/limit;
102
+
103
+ sum = 0;
104
+ i = samples.length-limit-1;
105
+ l = samples.length-(limit*2);
106
+ for(;i>=l;i--) {
107
+ sum = sum+samples[i];
108
+ }
109
+ var average2 = sum/limit;
110
+
111
+ if(average1>=average2) {
112
+ return true;
113
+ } else {
114
+ return false;
115
+ }
116
+ }
117
+ $.scrollify = function(options) {
118
+ $.easing['easeOutExpo'] = function(x, t, b, c, d) {
119
+ return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
120
+ };
121
+
122
+
123
+ manualScroll = {
124
+ handleMousedown:function() {
125
+ if(disabled===true) {
126
+ return true;
127
+ }
128
+ scrollable = false;
129
+ scrolled = false;
130
+ },
131
+ handleMouseup:function() {
132
+ if(disabled===true) {
133
+ return true;
134
+ }
135
+ scrollable = true;
136
+ if(scrolled) {
137
+ manualScroll.calculateNearest();
138
+ }
139
+ },
140
+ handleScroll:function() {
141
+ if(disabled===true) {
142
+ return true;
143
+ }
144
+ if(timeoutId){
145
+ clearTimeout(timeoutId);
146
+ }
147
+ timeoutId = setTimeout(function(){
148
+
149
+ scrolled = true;
150
+ if(scrollable===false) {
151
+ return false;
152
+ }
153
+ scrollable = false;
154
+ manualScroll.calculateNearest();
155
+
156
+ }, 200);
157
+ },
158
+ calculateNearest:function() {
159
+ top = $(window).scrollTop();
160
+ var i =1,
161
+ max = heights.length,
162
+ closest = 0,
163
+ prev = Math.abs(heights[0] - top),
164
+ diff;
165
+ for(;i<max;i++) {
166
+ diff = Math.abs(heights[i] - top);
167
+
168
+ if(diff < prev) {
169
+ prev = diff;
170
+ closest = i;
171
+ }
172
+ }
173
+ if(atBottom() || atTop()) {
174
+ index = closest;
175
+ animateScroll(closest,false);
176
+ }
177
+ },
178
+ wheelHandler:function(e,delta) {
179
+ if(disabled===true) {
180
+ return true;
181
+ }
182
+ if(!overflow[index]) {
183
+ e.preventDefault();
184
+ }
185
+ var currentScrollTime = new Date().getTime();
186
+ delta = delta || -e.originalEvent.detail / 3 || e.originalEvent.wheelDelta / 120;
187
+
188
+
189
+ if((currentScrollTime-scrollTime) > 1300){
190
+ scrollSamples = [];
191
+ }
192
+ scrollTime = currentScrollTime;
193
+
194
+ if(scrollSamples.length >= 35){
195
+ scrollSamples.shift();
196
+ }
197
+ scrollSamples.push(Math.abs(delta*10));
198
+
199
+ if(locked) {
200
+ return false;
201
+ }
202
+
203
+ if(delta<0) {
204
+ if(index<heights.length-1) {
205
+ if(atBottom()) {
206
+ if(isAccelerating(scrollSamples)) {
207
+ e.preventDefault();
208
+ index++;
209
+ locked = true;
210
+ animateScroll(index,false);
211
+ } else {
212
+ return false;
213
+ }
214
+ }
215
+ }
216
+ } else if(delta>0) {
217
+ if(index>0) {
218
+ if(atTop()) {
219
+ if(isAccelerating(scrollSamples)) {
220
+ e.preventDefault();
221
+ index--;
222
+ locked = true;
223
+ animateScroll(index,false);
224
+ } else {
225
+ return false
226
+ }
227
+ }
228
+ }
229
+ }
230
+
231
+ },
232
+ keyHandler:function(e) {
233
+ if(disabled===true) {
234
+ return true;
235
+ }
236
+ if(e.keyCode==38) {
237
+ if(index>0) {
238
+ if(atTop()) {
239
+ index--;
240
+ animateScroll(index,false);
241
+ }
242
+ }
243
+ } else if(e.keyCode==40) {
244
+ if(index<heights.length-1) {
245
+ if(atBottom()) {
246
+ index++;
247
+ animateScroll(index,false);
248
+ }
249
+ }
250
+ }
251
+ },
252
+ init:function() {
253
+ if(settings.scrollbars) {
254
+ $(window).bind('mousedown', manualScroll.handleMousedown);
255
+ $(window).bind('mouseup', manualScroll.handleMouseup);
256
+ $(window).bind('scroll', manualScroll.handleScroll);
257
+ } else {
258
+ $("body").css({"overflow":"hidden"});
259
+ }
260
+
261
+ $(document).bind('DOMMouseScroll mousewheel',manualScroll.wheelHandler);
262
+ $(document).bind('keydown', manualScroll.keyHandler);
263
+ }
264
+ };
265
+
266
+ swipeScroll = {
267
+ touches : {
268
+ "touchstart": {"y":-1},
269
+ "touchmove" : {"y":-1},
270
+ "touchend" : false,
271
+ "direction" : "undetermined"
272
+ },
273
+ options:{
274
+ "distance" : 30,
275
+ "timeGap" : 800,
276
+ "timeStamp" : new Date().getTime()
277
+ },
278
+ touchHandler: function(event) {
279
+ if(disabled===true) {
280
+ return true;
281
+ }
282
+ var touch;
283
+ if (typeof event !== 'undefined'){
284
+ if (typeof event.touches !== 'undefined') {
285
+ touch = event.touches[0];
286
+ switch (event.type) {
287
+ case 'touchstart':
288
+ swipeScroll.touches.touchstart.y = touch.pageY;
289
+ swipeScroll.touches.touchmove.y = -1;
290
+
291
+ swipeScroll.options.timeStamp = new Date().getTime();
292
+ swipeScroll.touches.touchend = false;
293
+ case 'touchmove':
294
+ swipeScroll.touches.touchmove.y = touch.pageY;
295
+ if(swipeScroll.touches.touchstart.y!==swipeScroll.touches.touchmove.y) {
296
+ //if(!overflow[index]) {
297
+ event.preventDefault();
298
+ //}
299
+ if((swipeScroll.options.timeStamp+swipeScroll.options.timeGap)<(new Date().getTime()) && swipeScroll.touches.touchend == false) {
300
+
301
+ swipeScroll.touches.touchend = true;
302
+ if (swipeScroll.touches.touchstart.y > -1) {
303
+
304
+ if(Math.abs(swipeScroll.touches.touchmove.y-swipeScroll.touches.touchstart.y)>swipeScroll.options.distance) {
305
+ if(swipeScroll.touches.touchstart.y < swipeScroll.touches.touchmove.y) {
306
+
307
+ swipeScroll.up();
308
+
309
+ } else {
310
+ swipeScroll.down();
311
+
312
+ }
313
+ }
314
+ }
315
+ }
316
+ }
317
+ break;
318
+ case 'touchend':
319
+ if(swipeScroll.touches[event.type]===false) {
320
+ swipeScroll.touches[event.type] = true;
321
+ if (swipeScroll.touches.touchstart.y > -1 && swipeScroll.touches.touchmove.y > -1) {
322
+
323
+ if(Math.abs(swipeScroll.touches.touchmove.y-swipeScroll.touches.touchstart.y)>swipeScroll.options.distance) {
324
+ if(swipeScroll.touches.touchstart.y < swipeScroll.touches.touchmove.y) {
325
+ swipeScroll.up();
326
+
327
+ } else {
328
+ swipeScroll.down();
329
+
330
+ }
331
+ }
332
+ swipeScroll.touches.touchstart.y = -1;
333
+ }
334
+ }
335
+ default:
336
+ break;
337
+ }
338
+ }
339
+ }
340
+ },
341
+ down: function() {
342
+ if(index<=heights.length-1) {
343
+ if(atBottom() && index<heights.length-1) {
344
+
345
+ index++;
346
+ animateScroll(index,false);
347
+ } else {
348
+ if(Math.floor(elements[index].height()/$(window).height())>interstitialIndex) {
349
+
350
+ interstitialScroll(parseInt(heights[index])+($(window).height()*interstitialIndex));
351
+ interstitialIndex += 1;
352
+
353
+ } else {
354
+ interstitialScroll(parseInt(heights[index])+(elements[index].height()-$(window).height()));
355
+ }
356
+
357
+ }
358
+ }
359
+ },
360
+ up: function() {
361
+ if(index>=0) {
362
+ if(atTop() && index>0) {
363
+
364
+ index--;
365
+ animateScroll(index,false);
366
+ } else {
367
+
368
+ if(interstitialIndex>2) {
369
+
370
+ interstitialIndex -= 1;
371
+ interstitialScroll(parseInt(heights[index])+($(window).height()*interstitialIndex));
372
+
373
+ } else {
374
+
375
+ interstitialIndex = 1;
376
+ interstitialScroll(parseInt(heights[index]));
377
+ }
378
+ }
379
+
380
+ }
381
+ },
382
+ init: function() {
383
+ if (document.addEventListener) {
384
+ document.addEventListener('touchstart', swipeScroll.touchHandler, false);
385
+ document.addEventListener('touchmove', swipeScroll.touchHandler, false);
386
+ document.addEventListener('touchend', swipeScroll.touchHandler, false);
387
+ }
388
+ }
389
+ };
390
+
391
+
392
+ util = {
393
+ handleResize:function() {
394
+ clearTimeout(timeoutId2);
395
+ timeoutId2 = setTimeout(function() {
396
+ sizePanels();
397
+ calculatePositions(true);
398
+ settings.afterResize();
399
+ },50);
400
+ }
401
+ };
402
+
403
+ settings = $.extend(settings, options);
404
+
405
+ sizePanels();
406
+
407
+ calculatePositions(false);
408
+
409
+
410
+ if(hasLocation===false && settings.sectionName) {
411
+ window.location.hash = names[0];
412
+ } else {
413
+ animateScroll(index,false);
414
+ }
415
+
416
+ manualScroll.init();
417
+ swipeScroll.init();
418
+
419
+ $(window).bind("resize",util.handleResize);
420
+ window.addEventListener("orientationchange", util.handleResize, false);
421
+
422
+ function interstitialScroll(pos) {
423
+ $(settings.target).stop().animate({
424
+ scrollTop: pos
425
+ }, settings.scrollSpeed,settings.easing);
426
+ }
427
+
428
+ function sizePanels() {
429
+ $(settings.section).each(function(i) {
430
+ if($(this).css("height","auto").outerHeight()<$(window).height()) {
431
+ $(this).css({"height":$(window).height()});
432
+ overflow[i] = false;
433
+ } else {
434
+ $(this).css({"height":$(this).height()});
435
+ overflow[i] = true;
436
+ }
437
+ });
438
+ }
439
+ function calculatePositions(resize) {
440
+ $(settings.section).each(function(i){
441
+ if(i>0) {
442
+ heights[i] = parseInt($(this).offset().top) + settings.offset;
443
+ } else {
444
+ heights[i] = parseInt($(this).offset().top);
445
+ }
446
+ if(settings.sectionName && $(this).data(settings.sectionName)) {
447
+ names[i] = "#" + $(this).data(settings.sectionName).replace(/ /g,"-");
448
+ } else {
449
+ names[i] = "#" + (i + 1);
450
+ }
451
+
452
+
453
+ elements[i] = $(this);
454
+
455
+ if(window.location.hash===names[i]) {
456
+ index = i;
457
+ hasLocation = true;
458
+
459
+ }
460
+ });
461
+
462
+
463
+ if(true===resize) {
464
+ animateScroll(index,false);
465
+ }
466
+ }
467
+
468
+ function atTop() {
469
+ top = $(window).scrollTop();
470
+ if(top>parseInt(heights[index])) {
471
+ return false;
472
+ } else {
473
+ return true;
474
+ }
475
+ }
476
+ function atBottom() {
477
+ top = $(window).scrollTop();
478
+ if(top<parseInt(heights[index])+(elements[index].height()-$(window).height())) {
479
+ return false;
480
+ } else {
481
+ return true;
482
+ }
483
+ }
484
+ }
485
+
486
+ function move(panel,instant) {
487
+ var z = names.length;
488
+ for(;z>=0;z--) {
489
+ if(typeof panel === 'string') {
490
+ if (names[z]===panel) {
491
+ index = z;
492
+ animateScroll(z,instant);
493
+ }
494
+ } else {
495
+ if(z===panel) {
496
+ index = z;
497
+ animateScroll(z,instant);
498
+ }
499
+ }
500
+ }
501
+ }
502
+ $.scrollify.move = function(panel) {
503
+ if(panel===undefined) {
504
+ return false;
505
+ }
506
+ move(panel,false);
507
+ };
508
+ $.scrollify.instantMove = function(panel) {
509
+ if(panel===undefined) {
510
+ return false;
511
+ }
512
+ move(panel,true);
513
+ };
514
+ $.scrollify.next = function() {
515
+ if(index<names.length) {
516
+ index += 1;
517
+ animateScroll(index,false);
518
+ }
519
+ };
520
+ $.scrollify.previous = function() {
521
+ if(index>0) {
522
+ index -= 1;
523
+ animateScroll(index,false);
524
+ }
525
+ };
526
+ $.scrollify.instantNext = function() {
527
+ if(index<names.length) {
528
+ index += 1;
529
+ animateScroll(index,true);
530
+ }
531
+ };
532
+ $.scrollify.instantPrevious = function() {
533
+ if(index>0) {
534
+ index -= 1;
535
+ animateScroll(index,true);
536
+ }
537
+ };
538
+ $.scrollify.destroy = function() {
539
+ $(settings.section).each(function() {
540
+ $(this).css("height","auto");
541
+ });
542
+ $(window).unbind("resize",util.handleResize);
543
+ if(settings.scrollbars) {
544
+ $(window).unbind('mousedown', manualScroll.handleMousedown);
545
+ $(window).unbind('mouseup', manualScroll.handleMouseup);
546
+ $(window).unbind('scroll', manualScroll.handleScroll);
547
+ }
548
+ $(document).unbind('DOMMouseScroll mousewheel',manualScroll.wheelHandler);
549
+ $(document).unbind('keydown', manualScroll.keyHandler);
550
+
551
+ if (document.addEventListener) {
552
+ document.removeEventListener('touchstart', swipeScroll.touchHandler, false);
553
+ document.removeEventListener('touchmove', swipeScroll.touchHandler, false);
554
+ document.removeEventListener('touchend', swipeScroll.touchHandler, false);
555
+ }
556
+ heights = [];
557
+ names = [];
558
+ elements = [];
559
+ overflow = [];
560
+ };
561
+ $.scrollify.update = function() {
562
+ util.handleResize();
563
+ };
564
+ $.scrollify.current = function() {
565
+ return elements[index];
566
+ };
567
+ $.scrollify.disable = function() {
568
+ disabled = true;
569
+ };
570
+ $.scrollify.enable = function() {
571
+ disabled = false;
572
+ };
573
+ $.scrollify.isDisabled = function() {
574
+ return disabled;
575
+ };
576
+ }(jQuery,this,document));
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scrollify
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Rahul Lakhaney
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-11-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Ruby gem for Luke Haas's scrollify jQuery plugin that assists scrolling
42
+ and snaps to sections. Touch optimised.
43
+ email:
44
+ - rahul.lakhaney@gmail.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - ".travis.yml"
51
+ - Gemfile
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - bin/console
56
+ - bin/setup
57
+ - lib/scrollify.rb
58
+ - lib/scrollify/version.rb
59
+ - scrollify.gemspec
60
+ - vendor/assets/javascripts/scrollify.js
61
+ homepage: http://www.github.com/rahullakhaney/scrollify
62
+ licenses:
63
+ - MIT
64
+ metadata: {}
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubyforge_project:
81
+ rubygems_version: 2.4.5.1
82
+ signing_key:
83
+ specification_version: 4
84
+ summary: A jQuery plugin that assists scrolling and snaps to sections.
85
+ test_files: []