sticky-rails 1.0.0 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +4 -13
- data/.gitignore +0 -22
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -22
- data/README.md +0 -61
- data/Rakefile +0 -2
- data/lib/sticky/rails.rb +0 -8
- data/lib/sticky/rails/version.rb +0 -5
- data/sticky-rails.gemspec +0 -24
- data/vendor/assets/javascripts/jquery.sticky.js +0 -170
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd33427b41c22c73089341a80b966714b13099d0
|
4
|
+
data.tar.gz: 61bfb1b3bbd88a7526ea8d922f350eb557a083bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 236058595a5c092ce90c2d4276f72612238c70c1f7e88507b0f368f7ac36c9447cd559b836545089a10e9e2f4c91eb990a5b800700f11ba32e0a8fdedb685156
|
7
|
+
data.tar.gz: 5c74c060ff7eaf7e15ee198b1a128d3dd3f676d8052d09656354df8278959880d4f91e9c88ff126214e1e28983232001c79f584a6e285297c195db25a5e14a7e
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sticky-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- navinspm
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,16 +44,7 @@ email:
|
|
44
44
|
executables: []
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
|
-
files:
|
48
|
-
- ".gitignore"
|
49
|
-
- Gemfile
|
50
|
-
- LICENSE.txt
|
51
|
-
- README.md
|
52
|
-
- Rakefile
|
53
|
-
- lib/sticky/rails.rb
|
54
|
-
- lib/sticky/rails/version.rb
|
55
|
-
- sticky-rails.gemspec
|
56
|
-
- vendor/assets/javascripts/jquery.sticky.js
|
47
|
+
files: []
|
57
48
|
homepage: https://github.com/navinspm/sticky-rails
|
58
49
|
licenses:
|
59
50
|
- MIT
|
@@ -74,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
65
|
version: '0'
|
75
66
|
requirements: []
|
76
67
|
rubyforge_project:
|
77
|
-
rubygems_version: 2.
|
68
|
+
rubygems_version: 2.4.8
|
78
69
|
signing_key:
|
79
70
|
specification_version: 4
|
80
71
|
summary: Sticky( http://stickyjs.com ) is a jQuery plugin that gives you the ability
|
data/.gitignore
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
|
-
coverage
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
18
|
-
*.bundle
|
19
|
-
*.so
|
20
|
-
*.o
|
21
|
-
*.a
|
22
|
-
mkmf.log
|
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2014 navinspm
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
Stickyjs Rails Gem - 1.0.0
|
2
|
-
|
3
|
-
jQuery sticky 1.0.0 - http://stickyjs.com/
|
4
|
-
|
5
|
-
sticky-rails Author: Navin Kumar, Copyright 2014 MIT license
|
6
|
-
|
7
|
-
Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
````
|
12
|
-
gem 'sticky-rails'
|
13
|
-
````
|
14
|
-
And then execute:
|
15
|
-
````
|
16
|
-
$ bundle install
|
17
|
-
````
|
18
|
-
Or install it yourself as:
|
19
|
-
````
|
20
|
-
$ gem install sticky-rails
|
21
|
-
````
|
22
|
-
Usage
|
23
|
-
|
24
|
-
Sticky is a jQuery plugin that gives you the ability to make any element on your page always stay visible. , so please check if you are using the jquery on your rails app
|
25
|
-
````
|
26
|
-
//= require jquery
|
27
|
-
````
|
28
|
-
Your app/assets/javascripts/application.js must appear like:
|
29
|
-
````
|
30
|
-
//= require jquery
|
31
|
-
//= require jquery_ujs
|
32
|
-
//= require sticky-rails
|
33
|
-
//= require_tree .
|
34
|
-
````
|
35
|
-
|
36
|
-
Basic Structure example from http://stickyjs.com/
|
37
|
-
````
|
38
|
-
<script>
|
39
|
-
$(document).ready(function(){
|
40
|
-
$("#sticker").sticky({topSpacing:0});
|
41
|
-
});
|
42
|
-
</script>
|
43
|
-
````
|
44
|
-
REMEMBER TO INITIALIZE IT!
|
45
|
-
|
46
|
-
If you are going to use coffee script:
|
47
|
-
````
|
48
|
-
$(document).ready ->
|
49
|
-
$("sticker").sticky()
|
50
|
-
````
|
51
|
-
Or just javascript:
|
52
|
-
````
|
53
|
-
$(document).ready(function(){
|
54
|
-
$("#sticker").sticky({topSpacing:0});
|
55
|
-
});
|
56
|
-
````
|
57
|
-
For more documentation please checkout the sticky-rails 4 repository here: https://github.com/garand/sticky
|
58
|
-
|
59
|
-
Gem Author
|
60
|
-
|
61
|
-
http://twitter.com/navinspm
|
data/Rakefile
DELETED
data/lib/sticky/rails.rb
DELETED
data/lib/sticky/rails/version.rb
DELETED
data/sticky-rails.gemspec
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'sticky/rails/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "sticky-rails"
|
8
|
-
spec.version = Sticky::Rails::VERSION
|
9
|
-
spec.authors = ["navinspm"]
|
10
|
-
spec.email = ["navinspm@gmail.com"]
|
11
|
-
spec.summary = "Sticky( http://stickyjs.com ) is a jQuery plugin that gives you the ability to
|
12
|
-
make any element on your page always stay visible .This is gemmified version of sticky "
|
13
|
-
spec.description = ""
|
14
|
-
spec.homepage = "https://github.com/navinspm/sticky-rails"
|
15
|
-
spec.license = "MIT"
|
16
|
-
|
17
|
-
spec.files = `git ls-files -z`.split("\x0")
|
18
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
-
spec.require_paths = ["lib"]
|
21
|
-
|
22
|
-
spec.add_development_dependency "bundler", "~> 1.6"
|
23
|
-
spec.add_development_dependency "rake"
|
24
|
-
end
|
@@ -1,170 +0,0 @@
|
|
1
|
-
// Sticky Plugin v1.0.0 for jQuery
|
2
|
-
// =============
|
3
|
-
// Author: Anthony Garand
|
4
|
-
// Improvements by German M. Bravo (Kronuz) and Ruud Kamphuis (ruudk)
|
5
|
-
// Improvements by Leonardo C. Daronco (daronco)
|
6
|
-
// Created: 2/14/2011
|
7
|
-
// Date: 2/12/2012
|
8
|
-
// Website: http://labs.anthonygarand.com/sticky
|
9
|
-
// Description: Makes an element on the page stick on the screen as you scroll
|
10
|
-
// It will only set the 'top' and 'position' of your element, you
|
11
|
-
// might need to adjust the width in some cases.
|
12
|
-
|
13
|
-
(function($) {
|
14
|
-
var defaults = {
|
15
|
-
topSpacing: 0,
|
16
|
-
bottomSpacing: 0,
|
17
|
-
className: 'is-sticky',
|
18
|
-
wrapperClassName: 'sticky-wrapper',
|
19
|
-
center: false,
|
20
|
-
getWidthFrom: '',
|
21
|
-
responsiveWidth: false
|
22
|
-
},
|
23
|
-
$window = $(window),
|
24
|
-
$document = $(document),
|
25
|
-
sticked = [],
|
26
|
-
windowHeight = $window.height(),
|
27
|
-
scroller = function() {
|
28
|
-
var scrollTop = $window.scrollTop(),
|
29
|
-
documentHeight = $document.height(),
|
30
|
-
dwh = documentHeight - windowHeight,
|
31
|
-
extra = (scrollTop > dwh) ? dwh - scrollTop : 0;
|
32
|
-
|
33
|
-
for (var i = 0; i < sticked.length; i++) {
|
34
|
-
var s = sticked[i],
|
35
|
-
elementTop = s.stickyWrapper.offset().top,
|
36
|
-
etse = elementTop - s.topSpacing - extra;
|
37
|
-
|
38
|
-
if (scrollTop <= etse) {
|
39
|
-
if (s.currentTop !== null) {
|
40
|
-
s.stickyElement
|
41
|
-
.css('position', '')
|
42
|
-
.css('top', '');
|
43
|
-
s.stickyElement.trigger('sticky-end', [s]).parent().removeClass(s.className);
|
44
|
-
s.currentTop = null;
|
45
|
-
}
|
46
|
-
}
|
47
|
-
else {
|
48
|
-
var newTop = documentHeight - s.stickyElement.outerHeight()
|
49
|
-
- s.topSpacing - s.bottomSpacing - scrollTop - extra;
|
50
|
-
if (newTop < 0) {
|
51
|
-
newTop = newTop + s.topSpacing;
|
52
|
-
} else {
|
53
|
-
newTop = s.topSpacing;
|
54
|
-
}
|
55
|
-
if (s.currentTop != newTop) {
|
56
|
-
s.stickyElement
|
57
|
-
.css('position', 'fixed')
|
58
|
-
.css('top', newTop);
|
59
|
-
|
60
|
-
if (typeof s.getWidthFrom !== 'undefined') {
|
61
|
-
s.stickyElement.css('width', $(s.getWidthFrom).width());
|
62
|
-
}
|
63
|
-
|
64
|
-
s.stickyElement.trigger('sticky-start', [s]).parent().addClass(s.className);
|
65
|
-
s.currentTop = newTop;
|
66
|
-
}
|
67
|
-
}
|
68
|
-
}
|
69
|
-
},
|
70
|
-
resizer = function() {
|
71
|
-
windowHeight = $window.height();
|
72
|
-
|
73
|
-
for (var i = 0; i < sticked.length; i++) {
|
74
|
-
var s = sticked[i];
|
75
|
-
if (typeof s.getWidthFrom !== 'undefined' && s.responsiveWidth === true) {
|
76
|
-
s.stickyElement.css('width', $(s.getWidthFrom).width());
|
77
|
-
}
|
78
|
-
}
|
79
|
-
},
|
80
|
-
methods = {
|
81
|
-
init: function(options) {
|
82
|
-
var o = $.extend({}, defaults, options);
|
83
|
-
return this.each(function() {
|
84
|
-
var stickyElement = $(this);
|
85
|
-
|
86
|
-
var stickyId = stickyElement.attr('id');
|
87
|
-
var wrapperId = stickyId ? stickyId + '-' + defaults.wrapperClassName : defaults.wrapperClassName
|
88
|
-
var wrapper = $('<div></div>')
|
89
|
-
.attr('id', stickyId + '-sticky-wrapper')
|
90
|
-
.addClass(o.wrapperClassName);
|
91
|
-
stickyElement.wrapAll(wrapper);
|
92
|
-
|
93
|
-
if (o.center) {
|
94
|
-
stickyElement.parent().css({width:stickyElement.outerWidth(),marginLeft:"auto",marginRight:"auto"});
|
95
|
-
}
|
96
|
-
|
97
|
-
if (stickyElement.css("float") == "right") {
|
98
|
-
stickyElement.css({"float":"none"}).parent().css({"float":"right"});
|
99
|
-
}
|
100
|
-
|
101
|
-
var stickyWrapper = stickyElement.parent();
|
102
|
-
stickyWrapper.css('height', stickyElement.outerHeight());
|
103
|
-
sticked.push({
|
104
|
-
topSpacing: o.topSpacing,
|
105
|
-
bottomSpacing: o.bottomSpacing,
|
106
|
-
stickyElement: stickyElement,
|
107
|
-
currentTop: null,
|
108
|
-
stickyWrapper: stickyWrapper,
|
109
|
-
className: o.className,
|
110
|
-
getWidthFrom: o.getWidthFrom,
|
111
|
-
responsiveWidth: o.responsiveWidth
|
112
|
-
});
|
113
|
-
});
|
114
|
-
},
|
115
|
-
update: scroller,
|
116
|
-
unstick: function(options) {
|
117
|
-
return this.each(function() {
|
118
|
-
var unstickyElement = $(this);
|
119
|
-
|
120
|
-
var removeIdx = -1;
|
121
|
-
for (var i = 0; i < sticked.length; i++)
|
122
|
-
{
|
123
|
-
if (sticked[i].stickyElement.get(0) == unstickyElement.get(0))
|
124
|
-
{
|
125
|
-
removeIdx = i;
|
126
|
-
}
|
127
|
-
}
|
128
|
-
if(removeIdx != -1)
|
129
|
-
{
|
130
|
-
sticked.splice(removeIdx,1);
|
131
|
-
unstickyElement.unwrap();
|
132
|
-
unstickyElement.removeAttr('style');
|
133
|
-
}
|
134
|
-
});
|
135
|
-
}
|
136
|
-
};
|
137
|
-
|
138
|
-
// should be more efficient than using $window.scroll(scroller) and $window.resize(resizer):
|
139
|
-
if (window.addEventListener) {
|
140
|
-
window.addEventListener('scroll', scroller, false);
|
141
|
-
window.addEventListener('resize', resizer, false);
|
142
|
-
} else if (window.attachEvent) {
|
143
|
-
window.attachEvent('onscroll', scroller);
|
144
|
-
window.attachEvent('onresize', resizer);
|
145
|
-
}
|
146
|
-
|
147
|
-
$.fn.sticky = function(method) {
|
148
|
-
if (methods[method]) {
|
149
|
-
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
150
|
-
} else if (typeof method === 'object' || !method ) {
|
151
|
-
return methods.init.apply( this, arguments );
|
152
|
-
} else {
|
153
|
-
$.error('Method ' + method + ' does not exist on jQuery.sticky');
|
154
|
-
}
|
155
|
-
};
|
156
|
-
|
157
|
-
$.fn.unstick = function(method) {
|
158
|
-
if (methods[method]) {
|
159
|
-
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
160
|
-
} else if (typeof method === 'object' || !method ) {
|
161
|
-
return methods.unstick.apply( this, arguments );
|
162
|
-
} else {
|
163
|
-
$.error('Method ' + method + ' does not exist on jQuery.sticky');
|
164
|
-
}
|
165
|
-
|
166
|
-
};
|
167
|
-
$(function() {
|
168
|
-
setTimeout(scroller, 0);
|
169
|
-
});
|
170
|
-
})(jQuery);
|