skrollr-rails 0.6.27 → 0.6.28
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa9d428c9c602aa99a62d2a221fa9264bc99b884
|
4
|
+
data.tar.gz: fe2a766c787113a571fed7d4d0815f20205a47d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 495245976b9495a0b327e70fc17d589ded15b13e8d965fb2a3d69697d81e0ac47ba8d1852e1ee16dcc57a81d482c9a77a638e70b5f426f00c3ba6a7ffbff1f42
|
7
|
+
data.tar.gz: 30bd98fe054124cc40fe5e131f87d185b4b63f1a298f9b1cfd4ab26e9dc48630c2c68c3d733e6216cdd004954c01d3b2d16fb5ea185df409e90a020cc9cf4332
|
@@ -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.28'
|
23
23
|
};
|
24
24
|
|
25
25
|
//Minify optimization.
|
@@ -1566,8 +1566,14 @@
|
|
1566
1566
|
* Returns the height of the document.
|
1567
1567
|
*/
|
1568
1568
|
var _getDocumentHeight = function() {
|
1569
|
-
var skrollrBodyHeight =
|
1570
|
-
var bodyHeight
|
1569
|
+
var skrollrBodyHeight = 0;
|
1570
|
+
var bodyHeight;
|
1571
|
+
|
1572
|
+
if(_skrollrBody) {
|
1573
|
+
skrollrBodyHeight = Math.max(_skrollrBody.offsetHeight, _skrollrBody.scrollHeight);
|
1574
|
+
}
|
1575
|
+
|
1576
|
+
bodyHeight = Math.max(skrollrBodyHeight, body.scrollHeight, body.offsetHeight, documentElement.scrollHeight, documentElement.offsetHeight, documentElement.clientHeight);
|
1571
1577
|
|
1572
1578
|
return bodyHeight - documentElement.clientHeight;
|
1573
1579
|
};
|
@@ -15,6 +15,7 @@
|
|
15
15
|
|
16
16
|
var MENU_TOP_ATTR = 'data-menu-top';
|
17
17
|
var MENU_OFFSET_ATTR = 'data-menu-offset';
|
18
|
+
var MENU_DURATION_ATTR = 'data-menu-duration';
|
18
19
|
|
19
20
|
var skrollr = window.skrollr;
|
20
21
|
var history = window.history;
|
@@ -65,11 +66,28 @@
|
|
65
66
|
When the fake flag is set, the link won't change the url and the position won't be animated.
|
66
67
|
*/
|
67
68
|
var handleLink = function(link, fake) {
|
68
|
-
|
69
|
-
var href = link.getAttribute('href');
|
69
|
+
var hash;
|
70
70
|
|
71
|
-
//
|
72
|
-
if(
|
71
|
+
//When complexLinks is enabled, we also accept links which do not just contain a simple hash.
|
72
|
+
if(_complexLinks) {
|
73
|
+
//The link points to something completely different.
|
74
|
+
if(link.hostname !== window.location.hostname) {
|
75
|
+
return false;
|
76
|
+
}
|
77
|
+
|
78
|
+
//The link does not link to the same page/path.
|
79
|
+
if(link.pathname !== document.location.pathname) {
|
80
|
+
return false;
|
81
|
+
}
|
82
|
+
|
83
|
+
hash = link.hash;
|
84
|
+
} else {
|
85
|
+
//Don't use the href property (link.href) because it contains the absolute url.
|
86
|
+
hash = link.getAttribute('href');
|
87
|
+
}
|
88
|
+
|
89
|
+
//Not a hash link.
|
90
|
+
if(!/^#/.test(hash)) {
|
73
91
|
return false;
|
74
92
|
}
|
75
93
|
|
@@ -95,7 +113,7 @@
|
|
95
113
|
targetTop = +menuTop * _scale;
|
96
114
|
}
|
97
115
|
} else {
|
98
|
-
var scrollTarget = document.getElementById(
|
116
|
+
var scrollTarget = document.getElementById(hash.substr(1));
|
99
117
|
|
100
118
|
//Ignore the click if no target is found.
|
101
119
|
if(!scrollTarget) {
|
@@ -112,13 +130,20 @@
|
|
112
130
|
}
|
113
131
|
|
114
132
|
if(supportsHistory && !fake) {
|
115
|
-
history.pushState({top: targetTop}, '',
|
133
|
+
history.pushState({top: targetTop}, '', hash);
|
134
|
+
}
|
135
|
+
|
136
|
+
var menuDuration = parseInt(link.getAttribute(MENU_DURATION_ATTR), 10);
|
137
|
+
var animationDuration = _duration(_skrollrInstance.getScrollTop(), targetTop);
|
138
|
+
|
139
|
+
if(!isNaN(menuDuration)) {
|
140
|
+
animationDuration = menuDuration;
|
116
141
|
}
|
117
142
|
|
118
143
|
//Now finally scroll there.
|
119
144
|
if(_animate && !fake) {
|
120
145
|
_skrollrInstance.animateTo(targetTop, {
|
121
|
-
duration:
|
146
|
+
duration: animationDuration,
|
122
147
|
easing: _easing
|
123
148
|
});
|
124
149
|
} else {
|
@@ -162,6 +187,7 @@
|
|
162
187
|
_duration = options.duration || DEFAULT_DURATION;
|
163
188
|
_handleLink = options.handleLink;
|
164
189
|
_scale = options.scale || DEFAULT_SCALE;
|
190
|
+
_complexLinks = options.complexLinks === true;
|
165
191
|
|
166
192
|
if(typeof _duration === 'number') {
|
167
193
|
_duration = (function(duration) {
|
@@ -202,6 +228,7 @@
|
|
202
228
|
var _animate;
|
203
229
|
var _handleLink;
|
204
230
|
var _scale;
|
231
|
+
var _complexLinks;
|
205
232
|
|
206
233
|
//In case the page was opened with a hash, prevent jumping to it.
|
207
234
|
//http://stackoverflow.com/questions/3659072/jquery-disable-anchor-jump-when-loading-a-page
|