diff --git a/README.md b/README.md index 2535baa..6d70eb2 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,9 @@ Do you already have a fixed horizontal header on the page? Offset stick 'em by t **start: 0**
If your sticky item isn't at the top of the container, tell it where it should start being sticky. +**stickAlways: false**
+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**
You can create a callback function that fires when an item gets "stuck". The item gets passed back. diff --git a/jquery.stickem.js b/jquery.stickem.js index df80958..ebf5276 100644 --- a/jquery.stickem.js +++ b/jquery.stickem.js @@ -32,6 +32,7 @@ endStickClass: 'stickit-end', offset: 0, start: 0, + stickAlways: false, onStick: null, onUnstick: null }, @@ -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: {