scrollToFixed_rails 1.0.1 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- OTZiNGRlMDE5OTBkYjU4ZjEyOWMxYjg1M2ZlMDBiMzUzMjE1ODMyMQ==
5
- data.tar.gz: !binary |-
6
- ZDhmZjEzMTEwOWZiMTc1ZjE1YzRkYTk0NWE3YzM1ZmExMDU2NTE1OQ==
2
+ SHA1:
3
+ metadata.gz: e01f80a2e3599c2d04ea4bcfcdd35c29eb51e82b
4
+ data.tar.gz: f3a7a223354ab6bad17f33bbd5a6a7852af7ec8c
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MGYwNzRkY2FkOTZkYTRjZTNmMjJiMjU1NTUyNGFjZjA2ZWZlZjAwM2IyN2Zl
10
- ODU3ZWVlZTQ5MWMzY2E1MTMyMDNhNWIwNTFlYWViMzI0ODFkMjI5MTUzZWJm
11
- MDFlMjM1YTY2YWViMjI5NGNhYzk4Mzc2ZTYxNTNjMTQwOWQzMTc=
12
- data.tar.gz: !binary |-
13
- YTIyNmQyZGFlZmYyNzFiYTNlZjgwMTFhNGNiZWRhOWNkMzEzNTAzZjkyODkw
14
- ZWFmZGE0OWViNzA5ZTlmYjIxZjE5ZjdhNTE1ZDgwZjFhNGYxMjMzNWMwNjU4
15
- MmYyMmEzMzBlNWExOGQ3ZjZjOGU2MmM1YzBlNDhjOWVkMDJjYWE=
6
+ metadata.gz: ea2f44183a1ab19acca9bde5949f45eacf94a44b56286a36bd906fbeea31bda254611b8ae6626585463f75287e62f537d3cf3ab2c5d2e71f34cc2b7304050079
7
+ data.tar.gz: 675965103a0326d22663bba02c9b0508187a0dc8c434f4b2f7c9b0ed1b1009f402e33128fd6ba3abc0cd5224446150d1038580a5cdd463f077a801f3c82ffb56
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .DS_Store
@@ -1,23 +1,10 @@
1
- // Copyright (c) 2011 Joseph Cava-Lynch
2
-
3
- // Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- // this software and associated documentation files (the "Software"), to deal in
5
- // the Software without restriction, including without limitation the rights to
6
- // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
- // the Software, and to permit persons to whom the Software is furnished to do so,
8
- // subject to the following conditions:
9
-
10
- // The above copyright notice and this permission notice shall be included in all
11
- // copies or substantial portions of the Software.
12
-
13
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
- // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
- // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
- // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
- // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
-
20
- // Version for debugging - 1.0.1
1
+ /*
2
+ * ScrollToFixed
3
+ * https://github.com/bigspotteddog/ScrollToFixed
4
+ *
5
+ * Copyright (c) 2011 Joseph Cava-Lynch
6
+ * MIT license
7
+ */
21
8
  (function($) {
22
9
  $.isScrollToFixed = function(el) {
23
10
  return !!$(el).data('ScrollToFixed');
@@ -44,8 +31,8 @@
44
31
 
45
32
  var position;
46
33
  var originalPosition;
47
-
48
34
  var originalOffsetTop;
35
+ var originalZIndex;
49
36
 
50
37
  // The offset top of the element when resetScroll was called. This is
51
38
  // used to determine if we have scrolled past the top of the element.
@@ -154,6 +141,7 @@
154
141
  // to the margin top specified in the options.
155
142
 
156
143
  cssOptions={
144
+ 'z-index' : base.options.zIndex,
157
145
  'position' : 'fixed',
158
146
  'top' : base.options.bottom == -1?getMarginTop():'',
159
147
  'bottom' : base.options.bottom == -1?'':base.options.bottom,
@@ -163,7 +151,7 @@
163
151
 
164
152
  target.css(cssOptions);
165
153
 
166
- target.addClass('scroll-to-fixed-fixed');
154
+ target.addClass(base.options.baseClassName);
167
155
 
168
156
  if (base.options.className) {
169
157
  target.addClass(base.options.className);
@@ -210,6 +198,7 @@
210
198
  // Remove the style attributes that were added to the target.
211
199
  // This will reverse the target back to the its original style.
212
200
  target.css({
201
+ 'z-index' : originalZIndex,
213
202
  'width' : '',
214
203
  'position' : originalPosition,
215
204
  'left' : '',
@@ -261,6 +250,15 @@
261
250
  // happens once.
262
251
  if (!isReset) {
263
252
  resetScroll();
253
+ } else if (isUnfixed()) {
254
+ // if the offset has changed since the last scroll,
255
+ // we need to get it again.
256
+
257
+ // Capture the offset top of the target element.
258
+ offsetTop = target.offset().top;
259
+
260
+ // Capture the offset left of the target element.
261
+ offsetLeft = target.offset().left;
264
262
  }
265
263
 
266
264
  // Grab the current horizontal scroll position.
@@ -386,7 +384,7 @@
386
384
  }
387
385
 
388
386
  var windowScroll = function(event) {
389
- checkScroll();
387
+ (!!window.requestAnimationFrame) ? requestAnimationFrame(checkScroll) : checkScroll();
390
388
  }
391
389
 
392
390
  // From: http://kangax.github.com/cft/#IS_POSITION_FIXED_SUPPORTED
@@ -434,8 +432,9 @@
434
432
  // and binds to the window scroll and resize events.
435
433
  base.init = function() {
436
434
  // Capture the options for this plugin.
437
- base.options = $
438
- .extend({}, $.ScrollToFixed.defaultOptions, options);
435
+ base.options = $.extend({}, $.ScrollToFixed.defaultOptions, options);
436
+
437
+ originalZIndex = target.css('z-index')
439
438
 
440
439
  // Turn off this functionality for devices that do not support it.
441
440
  // if (!(base.options && base.options.dontCheckForPositionFixedSupport)) {
@@ -539,7 +538,8 @@
539
538
  marginTop : 0,
540
539
  limit : 0,
541
540
  bottom : -1,
542
- zIndex : 1000
541
+ zIndex : 1000,
542
+ baseClassName: 'scroll-to-fixed-fixed'
543
543
  };
544
544
 
545
545
  // Returns enhanced elements that will fix to the top of the page when the
@@ -549,4 +549,4 @@
549
549
  (new $.ScrollToFixed(this, options));
550
550
  });
551
551
  };
552
- })(jQuery);
552
+ })(jQuery);
@@ -1,3 +1,3 @@
1
1
  module ScrollToFixedRails
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.5"
3
3
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrollToFixed_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guy Israeli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-22 00:00:00.000000000 Z
11
+ date: 2014-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: railties
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.1'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.1'
55
55
  description: An asset pipeline compatible wrapper for scrollToFixed.js
@@ -58,7 +58,7 @@ executables: []
58
58
  extensions: []
59
59
  extra_rdoc_files: []
60
60
  files:
61
- - .gitignore
61
+ - ".gitignore"
62
62
  - Gemfile
63
63
  - LICENSE.txt
64
64
  - README.md
@@ -77,17 +77,17 @@ require_paths:
77
77
  - lib
78
78
  required_ruby_version: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  requirements:
85
- - - ! '>='
85
+ - - ">="
86
86
  - !ruby/object:Gem::Version
87
87
  version: '0'
88
88
  requirements: []
89
89
  rubyforge_project:
90
- rubygems_version: 2.1.3
90
+ rubygems_version: 2.2.1
91
91
  signing_key:
92
92
  specification_version: 4
93
93
  summary: 9gag like Scroll 'n Float magic made possible with scrollToFixed.js