Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ Do you already have a fixed horizontal header on the page? Offset stick 'em by t
**start: 0**<br>
If your sticky item isn't at the top of the container, tell it where it should start being sticky.

**stickAlways: false**<br>
Controls whether the item is sticky when its height is larger than the browser window height: false: do not stick, true: always stick the item, regardless of its size.

**onStick: null**<br>
You can create a callback function that fires when an item gets "stuck". The item gets passed back.

Expand Down
5 changes: 3 additions & 2 deletions jquery.stickem.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
endStickClass: 'stickit-end',
offset: 0,
start: 0,
stickAlways: false,
onStick: null,
onUnstick: null
},
Expand Down Expand Up @@ -73,8 +74,8 @@
isStuck: false
};

//If the element is smaller than the window
if(_self.windowHeight > item.elemHeight) {
//Stick always or if the element is smaller than the window
if(_self.config.stickAlways || _self.windowHeight > item.elemHeight) {
item.containerHeight = item.$container.outerHeight();
item.containerInner = {
border: {
Expand Down