garand / sticky

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

Height of element not going back to initial value when scrolling back to top of the page #180

Open DavidScanu opened 9 years ago

DavidScanu commented 9 years ago

I have a navbar :

masthead { height: 130px; }

.is-sticky #masthead { height: 80px; }

So when user scrolls, the navbar's height goes from 130 px to 80 px.

But when scrolling back to the top of the page (initial state of the element), which correspond the event "sticky-end", Sticky JS puts an inline style of 'height: 80px' to the 'masthead-sticky-wrapper' element.

I did a quick fix like this, but not optimal at all :

$('#masthead').on('sticky-end', function() { $('#masthead-sticky-wrapper').css('height', '130px' ); });

Zackio commented 9 years ago

Same issue, only that I have the same issue as another thread where the stick-end isn't triggering

Zackio commented 9 years ago

Finding what it did in v1.0.2 where is doesn't update the height value on scroll. So commented out that line. Might be better to have it as a option

https://github.com/Zackio/sticky/blob/master/jquery.sticky.js

DavidScanu commented 8 years ago

Which line did you comment ?

Zackio commented 8 years ago

In my folk above line 54

DavidScanu commented 8 years ago

Thanks a lot. It is working now. I did comment this line : s.stickyWrapper.css('height', s.stickyElement.outerHeight());

Can you explain to me what is going on here ?