garand / sticky

jQuery Plugin for Sticky Objects
Other
3.3k stars 1.06k forks source link

Window height less than sticky wrapper #275

Open kamov opened 6 years ago

kamov commented 6 years ago

When window height is less than sticky wrapper, it's possible to add scrollable sticky wrapper or disable it?

Since at the moment it's not possible to scroll in this case.

godsdog commented 5 years ago

Have the same problem on an actual client site. Just fixed it with the following code: Put the following code at line 57 in jquery.sticky.js:

// Fix height issue on nearly equal height of document and window height
var preventSticky = false;
if ((documentHeight-windowHeight) < 100) {preventSticky = true;}
if (scrollTop <= etse || preventSticky) {

Change the value 100 to whatever you like. Thats the minimum difference of the window and document height in pixels.

godsdog commented 5 years ago

Would be great to add this to the options!