skrollr-rails 0.6.18 → 0.6.19
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 +51 -13
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66fe5b35160a73d4e2c206e315d823943d2e66b0
|
4
|
+
data.tar.gz: b97ea67a6a57614a746ebcfe1ae2d5995ba0aded
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80d7073ee02e87a92a17128638b6e47972a9c9a9a8470cded692756e5aa7d41d54a6df04636b029d785e81fd031ee2b1ba858f321bcb2c3941da0401c4b2ba4a
|
7
|
+
data.tar.gz: 63f1d21853374045bb7aae2142d4adaf1175e7a48096599dd594d3a0c558af3559695879f2587a8457f7375664af55b30268cf14ccd0652ca033989c09a63dc3
|
@@ -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.19'
|
23
23
|
};
|
24
24
|
|
25
25
|
//Minify optimization.
|
@@ -401,18 +401,20 @@
|
|
401
401
|
|
402
402
|
var constant = match[1];
|
403
403
|
|
404
|
-
|
405
|
-
|
404
|
+
if(constant) {
|
405
|
+
//Strip the underscore prefix.
|
406
|
+
kf.constant = constant.substr(1);
|
407
|
+
}
|
406
408
|
|
407
|
-
//
|
409
|
+
//Get the key frame offset.
|
408
410
|
var offset = match[2];
|
409
411
|
|
410
412
|
//Is it a percentage offset?
|
411
413
|
if(/p$/.test(offset)) {
|
412
414
|
kf.isPercentage = true;
|
413
|
-
kf.offset = (
|
415
|
+
kf.offset = (offset.slice(0, -1) | 0) / 100;
|
414
416
|
} else {
|
415
|
-
kf.offset = (offset | 0)
|
417
|
+
kf.offset = (offset | 0);
|
416
418
|
}
|
417
419
|
|
418
420
|
var anchor1 = match[3];
|
@@ -430,9 +432,7 @@
|
|
430
432
|
} else if(!kf.isPercentage) {
|
431
433
|
//For data-start we can already set the key frame w/o calculations.
|
432
434
|
//#59: "scale" options should only affect absolute mode.
|
433
|
-
kf.
|
434
|
-
|
435
|
-
delete kf.offset;
|
435
|
+
kf.offset = kf.offset * _scale;
|
436
436
|
}
|
437
437
|
}
|
438
438
|
//"relative" mode, where numbers are relative to anchors.
|
@@ -790,10 +790,13 @@
|
|
790
790
|
};
|
791
791
|
|
792
792
|
/**
|
793
|
-
* Updates key frames which depend on others.
|
793
|
+
* Updates key frames which depend on others / need to be updated on resize.
|
794
794
|
* That is "end" in "absolute" mode and all key frames in "relative" mode.
|
795
|
+
* Also handles constants, because they may change on resize.
|
795
796
|
*/
|
796
797
|
var _updateDependentKeyFrames = function() {
|
798
|
+
var viewportHeight = documentElement.clientHeight;
|
799
|
+
var processedConstants = _processConstants();
|
797
800
|
var skrollable;
|
798
801
|
var element;
|
799
802
|
var anchorTarget;
|
@@ -803,6 +806,8 @@
|
|
803
806
|
var kf;
|
804
807
|
var skrollableIndex;
|
805
808
|
var skrollablesLength;
|
809
|
+
var offset;
|
810
|
+
var constantValue;
|
806
811
|
|
807
812
|
//First process all relative-mode elements and find the max key frame.
|
808
813
|
skrollableIndex = 0;
|
@@ -820,11 +825,14 @@
|
|
820
825
|
for(; keyFrameIndex < keyFramesLength; keyFrameIndex++) {
|
821
826
|
kf = keyFrames[keyFrameIndex];
|
822
827
|
|
823
|
-
|
828
|
+
offset = kf.offset;
|
829
|
+
constantValue = processedConstants[kf.constant] || 0;
|
830
|
+
|
831
|
+
kf.frame = offset;
|
824
832
|
|
825
833
|
if(kf.isPercentage) {
|
826
834
|
//Convert the offset to percentage of the viewport height.
|
827
|
-
offset = offset *
|
835
|
+
offset = offset * viewportHeight;
|
828
836
|
|
829
837
|
//Absolute + percentage mode.
|
830
838
|
kf.frame = offset;
|
@@ -838,6 +846,8 @@
|
|
838
846
|
_reset(element, true);
|
839
847
|
}
|
840
848
|
|
849
|
+
kf.frame += constantValue;
|
850
|
+
|
841
851
|
//Only search for max key frame when forceHeight is enabled.
|
842
852
|
if(_forceHeight) {
|
843
853
|
//Find the max key frame, but don't use one of the data-end ones for comparison.
|
@@ -865,8 +875,10 @@
|
|
865
875
|
for(; keyFrameIndex < keyFramesLength; keyFrameIndex++) {
|
866
876
|
kf = keyFrames[keyFrameIndex];
|
867
877
|
|
878
|
+
constantValue = processedConstants[kf.constant] || 0;
|
879
|
+
|
868
880
|
if(kf.isEnd) {
|
869
|
-
kf.frame = _maxKeyFrame - kf.offset;
|
881
|
+
kf.frame = _maxKeyFrame - kf.offset + constantValue;
|
870
882
|
}
|
871
883
|
}
|
872
884
|
|
@@ -1447,6 +1459,32 @@
|
|
1447
1459
|
_forceRender = true;
|
1448
1460
|
};
|
1449
1461
|
|
1462
|
+
/*
|
1463
|
+
* Returns a copy of the constants object where all functions and strings have been evaluated.
|
1464
|
+
*/
|
1465
|
+
var _processConstants = function() {
|
1466
|
+
var viewportHeight = documentElement.clientHeight;
|
1467
|
+
var copy = {};
|
1468
|
+
var prop;
|
1469
|
+
var value;
|
1470
|
+
|
1471
|
+
for(prop in _constants) {
|
1472
|
+
value = _constants[prop];
|
1473
|
+
|
1474
|
+
if(typeof value === 'function') {
|
1475
|
+
value = value.call(_instance);
|
1476
|
+
}
|
1477
|
+
//Percentage offset.
|
1478
|
+
else if((/p$/).test(value)) {
|
1479
|
+
value = (value.substr(0, -1) / 100) * viewportHeight;
|
1480
|
+
}
|
1481
|
+
|
1482
|
+
copy[prop] = value;
|
1483
|
+
}
|
1484
|
+
|
1485
|
+
return copy;
|
1486
|
+
};
|
1487
|
+
|
1450
1488
|
/*
|
1451
1489
|
* Returns the height of the document.
|
1452
1490
|
*/
|