skrollr-rails 0.6.9 → 0.6.10

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: d5626de761b7901972f19f4277355e76216f0618
4
- data.tar.gz: 8c4c9c685a9401950575be87ad5fb6c42fb64790
3
+ metadata.gz: 12d689b283db05c2e2325eaae0848337f8e58fdc
4
+ data.tar.gz: 97be794435803db1a642af6ab8bfea580c3cd710
5
5
  SHA512:
6
- metadata.gz: 76583ccee883c1694638fffa79ae619be25200559ece7d1fbe4807fb4764509e12bbf665edd8ca84bbcbf56645cd5025cda8a8b6f4743092f0c3568a88bc109d
7
- data.tar.gz: d76f4d63911bb8d79cee67f12ab11aab2292ec14fcab0ded1105a961fe9e237bf57d45a708f23546863730a2b1af26d28405b9bf136316a9b56f929f5b20a721
6
+ metadata.gz: fac5868bc844e5ced65c3c616367b1276dd3c3a7a9d617cd76a8f498d9ba32678974dbad8f306c1b60d14fd4604b79e0c7578b38adc9d9397e62f666a4c4c901
7
+ data.tar.gz: 198cb2c74d10d22f6b1cbd18bfddb5c8604ba330fc704745bcbebae5f84a1d64f0cf671ddff5c834fbee20b1bec934266dd671a3434fef22c14afd465df8fba6
@@ -1,5 +1,5 @@
1
1
  module Skrollr
2
2
  module Rails
3
- VERSION = "0.6.9"
3
+ VERSION = "0.6.10"
4
4
  end
5
5
  end
@@ -19,7 +19,7 @@
19
19
  init: function(options) {
20
20
  return _instance || new Skrollr(options);
21
21
  },
22
- VERSION: '0.6.9'
22
+ VERSION: '0.6.10'
23
23
  };
24
24
 
25
25
  //Minify optimization.
@@ -274,7 +274,18 @@
274
274
  //Triggers parsing of elements and a first reflow.
275
275
  _instance.refresh();
276
276
 
277
- _addEvent(window, 'resize orientationchange', _reflow);
277
+ _addEvent(window, 'resize orientationchange', function() {
278
+ var width = documentElement.clientWidth;
279
+ var height = documentElement.clientHeight;
280
+
281
+ //Only reflow if the size actually changed (#271).
282
+ if(height !== _lastViewportHeight || width !== _lastViewportWidth) {
283
+ _lastViewportHeight = height;
284
+ _lastViewportWidth = width;
285
+
286
+ _requestReflow = true;
287
+ }
288
+ });
278
289
 
279
290
  var requestAnimFrame = polyfillRAF();
280
291
 
@@ -863,6 +874,11 @@
863
874
  * Renders all elements.
864
875
  */
865
876
  var _render = function() {
877
+ if(_requestReflow) {
878
+ _requestReflow = false;
879
+ _reflow();
880
+ }
881
+
866
882
  //We may render something else than the actual scrollbar position.
867
883
  var renderTop = _instance.getScrollTop();
868
884
 
@@ -1436,6 +1452,12 @@
1436
1452
  //The last time we called the render method (doesn't mean we rendered!).
1437
1453
  var _lastRenderCall = _now();
1438
1454
 
1455
+ //For detecting if it actually resized (#271).
1456
+ var _lastViewportWidth = 0;
1457
+ var _lastViewportHeight = 0;
1458
+
1459
+ var _requestReflow = false;
1460
+
1439
1461
  //Will contain data about a running scrollbar animation, if any.
1440
1462
  var _scrollAnimation;
1441
1463
 
@@ -104,7 +104,7 @@
104
104
  //Now finally scroll there.
105
105
  if(_animate && !fake) {
106
106
  _skrollrInstance.animateTo(targetTop, {
107
- duration: _duration,
107
+ duration: _duration(_skrollrInstance.getScrollTop(), targetTop),
108
108
  easing: _easing
109
109
  });
110
110
  } else {
@@ -129,9 +129,17 @@
129
129
 
130
130
  options = options || {};
131
131
 
132
- _duration = options.duration || DEFAULT_DURATION;
133
132
  _easing = options.easing || DEFAULT_EASING;
134
133
  _animate = options.animate !== false;
134
+ _duration = options.duration || DEFAULT_DURATION;
135
+
136
+ if(typeof _duration === 'number') {
137
+ _duration = (function(duration) {
138
+ return function() {
139
+ return duration;
140
+ };
141
+ }(_duration));
142
+ }
135
143
 
136
144
  //Use event bubbling and attach a single listener to the document.
137
145
  skrollr.addEvent(document, 'click', handleClick);
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.9
4
+ version: 0.6.10
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-07-10 00:00:00.000000000 Z
11
+ date: 2013-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails