garand / sticky

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

.sticky-wrapper still maintaining his height after scrollup #262

Closed pachooca closed 7 years ago

pachooca commented 7 years ago

I have a sticky menu with 3 items (menu btn, logo and custom button) image

When I scroll down, I successfully have the sticky menu: image

But I when I scroll back to top, the sticky-menu is "unsticked", but it looks like the sticky-wrapper height is still there: image

The white space at the top (121px) is exactly the height of my sticky-menu, image

And you see the result, as my content is pushed down.... :s

FWIW, my top content is a fullscreen carousel (so position:absolute) and the

is absolute positioned too, over this carousel.

Any idea why this .sticky-wrapper height isn't reset to 0?

pachooca commented 7 years ago

Well, I just found the solution, as mentionned here: https://github.com/garand/sticky/issues/180

I commented this line:

//update height in case of dynamic content
s.stickyWrapper.css('height', s.stickyElement.outerHeight());

(around line 55 for the 1.0.4 version)

It seems to have a problem with the sticky-end call and the height recalculation of the div

kevinmamaqi commented 5 years ago

I have the same problem, but it only happens when the div set to sticky is on top of the page.