skrollr-rails 0.6.12 → 0.6.13
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.
- checksums.yaml +4 -4
- data/lib/skrollr-rails/version.rb +1 -1
- data/vendor/assets/javascripts/skrollr.js +35 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f74f6fbadf8a2c8c6472aa99d0b34dbb1b54603
|
4
|
+
data.tar.gz: bbfe9617ee28c2de950fc818694a77fbf8a65a4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a67c6e9f466c1ea939cf5311ae6d9829a55d976c304313338e41c1b148bf3d56a352a52246ecb5faf58aed8d9380aff92c8e1a1dfbb7e84a8bd5308fcc456b86
|
7
|
+
data.tar.gz: 9f0879543a7b8d36a83c207a7762cfa10ca25634175ad8b156b515f7dab747d6ef4ab53e40acf3258338f319d9c9f23e8f1666af60372d3348fcd94e58674ab2
|
@@ -19,7 +19,7 @@
|
|
19
19
|
init: function(options) {
|
20
20
|
return _instance || new Skrollr(options);
|
21
21
|
},
|
22
|
-
VERSION: '0.6.
|
22
|
+
VERSION: '0.6.13'
|
23
23
|
};
|
24
24
|
|
25
25
|
//Minify optimization.
|
@@ -63,7 +63,7 @@
|
|
63
63
|
var rxTrim = /^\s+|\s+$/g;
|
64
64
|
|
65
65
|
//Find all data-attributes. data-[_constant]-[offset]-[anchor]-[anchor].
|
66
|
-
var rxKeyframeAttribute = /^data(?:-(_\w+))?(?:-?(-?\d+))?(?:-?(start|end|top|center|bottom))?(?:-?(top|center|bottom))?$/;
|
66
|
+
var rxKeyframeAttribute = /^data(?:-(_\w+))?(?:-?(-?\d*\.?\d+p?))?(?:-?(start|end|top|center|bottom))?(?:-?(top|center|bottom))?$/;
|
67
67
|
|
68
68
|
var rxPropValue = /\s*([\w\-\[\]]+)\s*:\s*(.+?)\s*(?:;|$)/gi;
|
69
69
|
|
@@ -389,37 +389,46 @@
|
|
389
389
|
continue;
|
390
390
|
}
|
391
391
|
|
392
|
+
var kf = {
|
393
|
+
props: attr.value,
|
394
|
+
//Point back to the element as well.
|
395
|
+
element: el
|
396
|
+
};
|
397
|
+
|
398
|
+
keyFrames.push(kf);
|
399
|
+
|
392
400
|
var constant = match[1];
|
393
401
|
|
394
402
|
//If there is a constant, get it's value or fall back to 0.
|
395
403
|
constant = constant && _constants[constant.substr(1)] || 0;
|
396
404
|
|
397
405
|
//Parse key frame offset. If undefined will be casted to 0.
|
398
|
-
var offset =
|
406
|
+
var offset = match[2];
|
407
|
+
|
408
|
+
//Is it a percentage offset?
|
409
|
+
if(/p$/.test(offset)) {
|
410
|
+
kf.isPercentage = true;
|
411
|
+
kf.offset = ((offset.slice(0, -1) | 0) + constant) / 100;
|
412
|
+
} else {
|
413
|
+
kf.offset = (offset | 0) + constant;
|
414
|
+
}
|
415
|
+
|
399
416
|
var anchor1 = match[3];
|
417
|
+
|
400
418
|
//If second anchor is not set, the first will be taken for both.
|
401
419
|
var anchor2 = match[4] || anchor1;
|
402
420
|
|
403
|
-
var kf = {
|
404
|
-
offset: offset,
|
405
|
-
props: attr.value,
|
406
|
-
//Point back to the element as well.
|
407
|
-
element: el
|
408
|
-
};
|
409
|
-
|
410
|
-
keyFrames.push(kf);
|
411
|
-
|
412
421
|
//"absolute" (or "classic") mode, where numbers mean absolute scroll offset.
|
413
422
|
if(!anchor1 || anchor1 === ANCHOR_START || anchor1 === ANCHOR_END) {
|
414
423
|
kf.mode = 'absolute';
|
415
424
|
|
416
|
-
//data-end needs to be calculated after all key frames are
|
425
|
+
//data-end needs to be calculated after all key frames are known.
|
417
426
|
if(anchor1 === ANCHOR_END) {
|
418
427
|
kf.isEnd = true;
|
419
|
-
} else {
|
428
|
+
} else if(!kf.isPercentage) {
|
420
429
|
//For data-start we can already set the key frame w/o calculations.
|
421
430
|
//#59: "scale" options should only affect absolute mode.
|
422
|
-
kf.frame = offset * _scale;
|
431
|
+
kf.frame = kf.offset * _scale;
|
423
432
|
|
424
433
|
delete kf.offset;
|
425
434
|
}
|
@@ -788,10 +797,20 @@
|
|
788
797
|
for(; keyFrameIndex < keyFramesLength; keyFrameIndex++) {
|
789
798
|
kf = keyFrames[keyFrameIndex];
|
790
799
|
|
800
|
+
var offset = kf.offset;
|
801
|
+
|
802
|
+
if(kf.isPercentage) {
|
803
|
+
//Convert the offset to percentage of the viewport height.
|
804
|
+
offset = offset * documentElement.clientHeight;
|
805
|
+
|
806
|
+
//Absolute + percentage mode.
|
807
|
+
kf.frame = offset;
|
808
|
+
}
|
809
|
+
|
791
810
|
if(kf.mode === 'relative') {
|
792
811
|
_reset(element);
|
793
812
|
|
794
|
-
kf.frame = _instance.relativeToAbsolute(anchorTarget, kf.anchors[0], kf.anchors[1]) -
|
813
|
+
kf.frame = _instance.relativeToAbsolute(anchorTarget, kf.anchors[0], kf.anchors[1]) - offset;
|
795
814
|
|
796
815
|
_reset(element, true);
|
797
816
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skrollr-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Reed
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|