skrollr-rails 0.6.17 → 0.6.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f2a4e524513a3fcc1bce8801cd4e0c4988582d1
4
- data.tar.gz: 929ee48321fdc2726e0592fbf883123ebe30370f
3
+ metadata.gz: 0b0711aeba31d3dfacb79fbe8b261990286913e5
4
+ data.tar.gz: 1e037a545ae4cbe7fad4a922f86c9ddf48af51f7
5
5
  SHA512:
6
- metadata.gz: afdc7eff57a77a7cff835b81efd9394c7e28a01cf904c16683a52407ed5e2b9fa65f0db78b41cb95bef7e9545e1682afdc1751a73508126d9bf5e08db3c2fdb9
7
- data.tar.gz: c6d2fca63f09370db4b16b36790ac0d564325c6543ff8ecaf21a04d66a5a7a17522780548199d3c768c04495c69aa080b2d41a3893ac3a73e5dc9f67075d4e0a
6
+ metadata.gz: b3846cc5e3288a4ef106d71a3eb3d23ca51565e91af38d7b7f94d130045249fea37af10d00e797da563aeb87955630946797693cd5c659bb27c221694db3aa96
7
+ data.tar.gz: e4ab8a4af0572e44dc4d03ddf16e9040c851726462d40b23d8aa4e6fb031c4b024f0cfdc71fbc6e43bb66f4b9bbec5f06f6ea7b0dfe0c194693b92bc6ff1ac3e
@@ -1,5 +1,5 @@
1
1
  module Skrollr
2
2
  module Rails
3
- VERSION = "0.6.17"
3
+ VERSION = "0.6.18"
4
4
  end
5
5
  end
@@ -27,8 +27,8 @@
27
27
  if(prop === 'opacity') {
28
28
  style.zoom = 1;
29
29
 
30
- //Remove filter attribute in IE
31
- if(val >= 1 && style.removeAttribute) {
30
+ //Remove filter attribute in IE.
31
+ if(val === 1 && style.removeAttribute) {
32
32
  style.removeAttribute('filter');
33
33
  } else {
34
34
  style.filter = 'alpha(opacity=' + val * 100 + ')';
@@ -718,6 +718,11 @@
718
718
 
719
719
  break;
720
720
  case EVENT_TOUCHMOVE:
721
+ //Prevent default event on touchIgnore elements in case they don't have focus yet.
722
+ if(rxTouchIgnoreTags.test(currentElement.tagName) && document.activeElement !== currentElement) {
723
+ e.preventDefault();
724
+ }
725
+
721
726
  deltaY = currentTouchY - lastTouchY;
722
727
  deltaTime = currentTouchTime - lastTouchTime;
723
728
 
@@ -11,6 +11,7 @@
11
11
 
12
12
  var DEFAULT_DURATION = 500;
13
13
  var DEFAULT_EASING = 'sqrt';
14
+ var DEFAULT_SCALE = 1;
14
15
 
15
16
  var MENU_TOP_ATTR = 'data-menu-top';
16
17
  var MENU_OFFSET_ATTR = 'data-menu-offset';
@@ -75,11 +76,24 @@
75
76
  //Now get the targetTop to scroll to.
76
77
  var targetTop;
77
78
 
78
- //If there's a data-menu-top attribute, it overrides the actuall anchor offset.
79
- var menuTop = link.getAttribute(MENU_TOP_ATTR);
79
+ var menuTop;
80
+
81
+ //If there's a handleLink function, it overrides the actual anchor offset.
82
+ if(_handleLink) {
83
+ menuTop = _handleLink(link);
84
+ }
85
+ //If there's a data-menu-top attribute and no handleLink function, it overrides the actual anchor offset.
86
+ else {
87
+ menuTop = link.getAttribute(MENU_TOP_ATTR);
88
+ }
80
89
 
81
90
  if(menuTop !== null) {
82
- targetTop = +menuTop;
91
+ //Is it a percentage offset?
92
+ if(/p$/.test(menuTop)) {
93
+ targetTop = (menuTop.slice(0, -1) / 100) * document.documentElement.clientHeight;
94
+ } else {
95
+ targetTop = +menuTop * _scale;
96
+ }
83
97
  } else {
84
98
  var scrollTarget = document.getElementById(href.substr(1));
85
99
 
@@ -142,6 +156,8 @@
142
156
  _easing = options.easing || DEFAULT_EASING;
143
157
  _animate = options.animate !== false;
144
158
  _duration = options.duration || DEFAULT_DURATION;
159
+ _handleLink = options.handleLink;
160
+ _scale = options.scale || DEFAULT_SCALE;
145
161
 
146
162
  if(typeof _duration === 'number') {
147
163
  _duration = (function(duration) {
@@ -174,6 +190,8 @@
174
190
  var _easing;
175
191
  var _duration;
176
192
  var _animate;
193
+ var _handleLink;
194
+ var _scale;
177
195
 
178
196
  //In case the page was opened with a hash, prevent jumping to it.
179
197
  //http://stackoverflow.com/questions/3659072/jquery-disable-anchor-jump-when-loading-a-page
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.17
4
+ version: 0.6.18
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-05 00:00:00.000000000 Z
11
+ date: 2014-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails