scrollToFixed_rails 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/app/assets/javascripts/scrolltofixed.js +30 -20
- data/lib/scrollToFixed_rails/version.rb +1 -1
- metadata +5 -13
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
OTZiNGRlMDE5OTBkYjU4ZjEyOWMxYjg1M2ZlMDBiMzUzMjE1ODMyMQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZDhmZjEzMTEwOWZiMTc1ZjE1YzRkYTk0NWE3YzM1ZmExMDU2NTE1OQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MGYwNzRkY2FkOTZkYTRjZTNmMjJiMjU1NTUyNGFjZjA2ZWZlZjAwM2IyN2Zl
|
10
|
+
ODU3ZWVlZTQ5MWMzY2E1MTMyMDNhNWIwNTFlYWViMzI0ODFkMjI5MTUzZWJm
|
11
|
+
MDFlMjM1YTY2YWViMjI5NGNhYzk4Mzc2ZTYxNTNjMTQwOWQzMTc=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YTIyNmQyZGFlZmYyNzFiYTNlZjgwMTFhNGNiZWRhOWNkMzEzNTAzZjkyODkw
|
14
|
+
ZWFmZGE0OWViNzA5ZTlmYjIxZjE5ZjdhNTE1ZDgwZjFhNGYxMjMzNWMwNjU4
|
15
|
+
MmYyMmEzMzBlNWExOGQ3ZjZjOGU2MmM1YzBlNDhjOWVkMDJjYWE=
|
@@ -17,8 +17,7 @@
|
|
17
17
|
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18
18
|
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
19
19
|
|
20
|
-
// Version for debugging - 1.0.
|
21
|
-
|
20
|
+
// Version for debugging - 1.0.1
|
22
21
|
(function($) {
|
23
22
|
$.isScrollToFixed = function(el) {
|
24
23
|
return !!$(el).data('ScrollToFixed');
|
@@ -46,7 +45,7 @@
|
|
46
45
|
var position;
|
47
46
|
var originalPosition;
|
48
47
|
|
49
|
-
var
|
48
|
+
var originalOffsetTop;
|
50
49
|
|
51
50
|
// The offset top of the element when resetScroll was called. This is
|
52
51
|
// used to determine if we have scrolled past the top of the element.
|
@@ -90,12 +89,12 @@
|
|
90
89
|
|
91
90
|
// Capture the offset left of the target element.
|
92
91
|
offsetLeft = target.offset().left;
|
93
|
-
|
92
|
+
|
94
93
|
// If the offsets option is on, alter the left offset.
|
95
94
|
if (base.options.offsets) {
|
96
95
|
offsetLeft += (target.offset().left - target.position().left);
|
97
96
|
}
|
98
|
-
|
97
|
+
|
99
98
|
if (originalOffsetLeft == -1) {
|
100
99
|
originalOffsetLeft = offsetLeft;
|
101
100
|
}
|
@@ -104,7 +103,7 @@
|
|
104
103
|
|
105
104
|
// Set that this has been called at least once.
|
106
105
|
isReset = true;
|
107
|
-
|
106
|
+
|
108
107
|
if (base.options.bottom != -1) {
|
109
108
|
target.trigger('preFixed.ScrollToFixed');
|
110
109
|
setFixed();
|
@@ -153,7 +152,7 @@
|
|
153
152
|
// Set the target element to fixed and set its width so it does
|
154
153
|
// not fill the rest of the page horizontally. Also, set its top
|
155
154
|
// to the margin top specified in the options.
|
156
|
-
|
155
|
+
|
157
156
|
cssOptions={
|
158
157
|
'position' : 'fixed',
|
159
158
|
'top' : base.options.bottom == -1?getMarginTop():'',
|
@@ -161,9 +160,9 @@
|
|
161
160
|
'margin-left' : '0px'
|
162
161
|
}
|
163
162
|
if (!base.options.dontSetWidth){ cssOptions['width']=target.width(); };
|
164
|
-
|
163
|
+
|
165
164
|
target.css(cssOptions);
|
166
|
-
|
165
|
+
|
167
166
|
target.addClass('scroll-to-fixed-fixed');
|
168
167
|
|
169
168
|
if (base.options.className) {
|
@@ -180,7 +179,7 @@
|
|
180
179
|
var left = offsetLeft;
|
181
180
|
|
182
181
|
if (base.options.removeOffsets) {
|
183
|
-
left =
|
182
|
+
left = '';
|
184
183
|
top = top - offsetTop;
|
185
184
|
}
|
186
185
|
|
@@ -190,9 +189,9 @@
|
|
190
189
|
'left' : left,
|
191
190
|
'margin-left' : '0px',
|
192
191
|
'bottom' : ''
|
193
|
-
}
|
192
|
+
}
|
194
193
|
if (!base.options.dontSetWidth){ cssOptions['width']=target.width(); };
|
195
|
-
|
194
|
+
|
196
195
|
target.css(cssOptions);
|
197
196
|
|
198
197
|
position = 'absolute';
|
@@ -214,7 +213,7 @@
|
|
214
213
|
'width' : '',
|
215
214
|
'position' : originalPosition,
|
216
215
|
'left' : '',
|
217
|
-
'top' :
|
216
|
+
'top' : originalOffsetTop,
|
218
217
|
'margin-left' : ''
|
219
218
|
});
|
220
219
|
|
@@ -283,6 +282,13 @@
|
|
283
282
|
setUnfixed();
|
284
283
|
target.trigger('unfixed.ScrollToFixed');
|
285
284
|
}
|
285
|
+
} else if (base.options.maxWidth && $(window).width() > base.options.maxWidth) {
|
286
|
+
if (!isUnfixed() || !wasReset) {
|
287
|
+
postPosition();
|
288
|
+
target.trigger('preUnfixed.ScrollToFixed');
|
289
|
+
setUnfixed();
|
290
|
+
target.trigger('unfixed.ScrollToFixed');
|
291
|
+
}
|
286
292
|
} else if (base.options.bottom == -1) {
|
287
293
|
// If the vertical scroll position, plus the optional margin, would
|
288
294
|
// put the target element at the specified limit, set the target
|
@@ -329,7 +335,7 @@
|
|
329
335
|
if (isFixed()) {
|
330
336
|
postPosition();
|
331
337
|
target.trigger('preUnfixed.ScrollToFixed');
|
332
|
-
|
338
|
+
|
333
339
|
if (originalPosition === 'absolute') {
|
334
340
|
setAbsolute();
|
335
341
|
} else {
|
@@ -360,7 +366,7 @@
|
|
360
366
|
|
361
367
|
function postPosition() {
|
362
368
|
var position = target.css('position');
|
363
|
-
|
369
|
+
|
364
370
|
if (position == 'absolute') {
|
365
371
|
target.trigger('postAbsolute.ScrollToFixed');
|
366
372
|
} else if (position == 'fixed') {
|
@@ -376,7 +382,7 @@
|
|
376
382
|
if(target.is(':visible')) {
|
377
383
|
isReset = false;
|
378
384
|
checkScroll();
|
379
|
-
|
385
|
+
}
|
380
386
|
}
|
381
387
|
|
382
388
|
var windowScroll = function(event) {
|
@@ -449,7 +455,7 @@
|
|
449
455
|
position = target.css('position');
|
450
456
|
originalPosition = target.css('position');
|
451
457
|
|
452
|
-
|
458
|
+
originalOffsetTop = target.css('top');
|
453
459
|
|
454
460
|
// Place the spacer right after the target element.
|
455
461
|
if (isUnfixed()) base.$el.after(spacer);
|
@@ -461,7 +467,7 @@
|
|
461
467
|
// When the window scrolls, check to see if we need to fix or unfix
|
462
468
|
// the target element.
|
463
469
|
$(window).bind('scroll.ScrollToFixed', windowScroll);
|
464
|
-
|
470
|
+
|
465
471
|
if (base.options.preFixed) {
|
466
472
|
target.bind('preFixed.ScrollToFixed', base.options.preFixed);
|
467
473
|
}
|
@@ -504,7 +510,7 @@
|
|
504
510
|
|
505
511
|
target.bind('detach.ScrollToFixed', function(ev) {
|
506
512
|
preventDefault(ev);
|
507
|
-
|
513
|
+
|
508
514
|
target.trigger('preUnfixed.ScrollToFixed');
|
509
515
|
setUnfixed();
|
510
516
|
target.trigger('unfixed.ScrollToFixed');
|
@@ -513,9 +519,13 @@
|
|
513
519
|
$(window).unbind('scroll.ScrollToFixed', windowScroll);
|
514
520
|
|
515
521
|
target.unbind('.ScrollToFixed');
|
522
|
+
|
523
|
+
//remove spacer from dom
|
524
|
+
spacer.remove();
|
525
|
+
|
516
526
|
base.$el.removeData('ScrollToFixed');
|
517
527
|
});
|
518
|
-
|
528
|
+
|
519
529
|
// Reset everything.
|
520
530
|
windowResize();
|
521
531
|
};
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrollToFixed_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Guy Israeli
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-01-22 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: railties
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ! '>='
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -77,26 +70,25 @@ files:
|
|
77
70
|
homepage: https://github.com/guyisra/scrollToFixed_rails
|
78
71
|
licenses:
|
79
72
|
- MIT
|
73
|
+
metadata: {}
|
80
74
|
post_install_message:
|
81
75
|
rdoc_options: []
|
82
76
|
require_paths:
|
83
77
|
- lib
|
84
78
|
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
-
none: false
|
86
79
|
requirements:
|
87
80
|
- - ! '>='
|
88
81
|
- !ruby/object:Gem::Version
|
89
82
|
version: '0'
|
90
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
-
none: false
|
92
84
|
requirements:
|
93
85
|
- - ! '>='
|
94
86
|
- !ruby/object:Gem::Version
|
95
87
|
version: '0'
|
96
88
|
requirements: []
|
97
89
|
rubyforge_project:
|
98
|
-
rubygems_version: 1.
|
90
|
+
rubygems_version: 2.1.3
|
99
91
|
signing_key:
|
100
|
-
specification_version:
|
92
|
+
specification_version: 4
|
101
93
|
summary: 9gag like Scroll 'n Float magic made possible with scrollToFixed.js
|
102
94
|
test_files: []
|