skrollr-rails 0.6.15 → 0.6.16

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: 2506acbc1d652c7ccd09d60e02553493e2871d7d
4
- data.tar.gz: 755b5e86c6efbb0b30e6366cd2711ef3de0b2270
3
+ metadata.gz: 2c81290ed073e2155007ec15149cf1bc759b6d53
4
+ data.tar.gz: 4ee1a773f944d7b1828037a3c5c80d82610f115a
5
5
  SHA512:
6
- metadata.gz: 8fa5312f5dbcc521b2c880fdee4fa724227e3033a0d19fa2e6a4e5cada8e3e8137c4e509868ca81bc5fa9f8397ff8a0777203e04c03890e538a5d93563f0ff19
7
- data.tar.gz: 036128af38adae715c27478f9dbc63d09402215eff22d393c450c8ce68338c0713aa15d0cc7f082bdf7a988e90b267b3d2ade34097821cb52713f1b176e0d1b3
6
+ metadata.gz: bbd79792287a6d4c5dbfa56eaa208ee026600ccfb431c76d8498b3f9e891f7400fdfd2acd1923853eaf8b07c823a5f79e0e4b9ebc4965edc34ce6632ee06b26c
7
+ data.tar.gz: 30b55e4dea3e1e43ab48a3aa3b39f84da1767aeb969f5b9351b9c85479eecd49f2add883130a8ccfb20c88c12c922796eb01f48bea9e8b3f3f8bf38fb5011f28
@@ -1,5 +1,5 @@
1
1
  module Skrollr
2
2
  module Rails
3
- VERSION = "0.6.15"
3
+ VERSION = "0.6.16"
4
4
  end
5
5
  end
@@ -1303,8 +1303,14 @@
1303
1303
  //Make sure z-index gets a <integer>.
1304
1304
  //This is the only <integer> case we need to handle.
1305
1305
  if(prop === 'zIndex') {
1306
- //Floor
1307
- style[prop] = '' + (val | 0);
1306
+ if(isNaN(val)) {
1307
+ //If it's not a number, don't touch it.
1308
+ //It could for example be "auto" (#351).
1309
+ style[prop] = val;
1310
+ } else {
1311
+ //Floor the number.
1312
+ style[prop] = '' + (val | 0);
1313
+ }
1308
1314
  }
1309
1315
  //#64: "float" can't be set across browsers. Needs to use "cssFloat" for all except IE.
1310
1316
  else if(prop === 'float') {
@@ -43,7 +43,7 @@
43
43
  */
44
44
  var handleClick = function(e) {
45
45
  //Only handle left click.
46
- if((e.which || e.button) !== 1) {
46
+ if(e.which !== 1 && e.button !== 0) {
47
47
  return;
48
48
  }
49
49
 
@@ -116,6 +116,16 @@
116
116
  return true;
117
117
  };
118
118
 
119
+ var jumpStraightToHash = function() {
120
+ if(window.location.hash && document.querySelector) {
121
+ var link = document.querySelector('a[href="' + window.location.hash + '"]');
122
+
123
+ if(link) {
124
+ handleLink(link, true);
125
+ }
126
+ }
127
+ };
128
+
119
129
  var defer = function(fn) {
120
130
  window.setTimeout(fn, 1);
121
131
  };
@@ -145,7 +155,7 @@
145
155
  skrollr.addEvent(document, 'click', handleClick);
146
156
 
147
157
  if(supportsHistory) {
148
- window.addEventListener('popstate', function(e) {
158
+ skrollr.addEvent(window, 'popstate', function(e) {
149
159
  var state = e.state || {};
150
160
  var top = state.top || 0;
151
161
 
@@ -154,6 +164,8 @@
154
164
  });
155
165
  }, false);
156
166
  }
167
+
168
+ jumpStraightToHash();
157
169
  };
158
170
 
159
171
  //Private reference to the initialized skrollr.
@@ -168,14 +180,6 @@
168
180
  defer(function() {
169
181
  if(window.location.hash) {
170
182
  window.scrollTo(0, 0);
171
-
172
- if(document.querySelector) {
173
- var link = document.querySelector('a[href="' + window.location.hash + '"]');
174
-
175
- if(link) {
176
- handleLink(link, true);
177
- }
178
- }
179
183
  }
180
184
  });
181
185
  }(document, window));
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skrollr-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.15
4
+ version: 0.6.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Reed