garand / sticky

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

version 1.0.4 broken my code. `Uncaught TypeError: Cannot read property 'top' of undefined` #247

Open kntmrkm opened 7 years ago

kntmrkm commented 7 years ago

I got below error. Uncaught TypeError: Cannot read property 'top' of undefined

The error occurs when upgrade from 1.0.3 to 1.0.4.

// Check if sticky has reached end of container and stop sticking
          var stickyWrapperContainer = s.stickyWrapper.parent();
          var unstick = (s.stickyElement.offset().top + s.stickyElement.outerHeight() >= stickyWrapperContainer.offset().top + stickyWrapperContainer.outerHeight()) && (s.stickyElement.offset().top <= s.topSpacing);

https://github.com/garand/sticky/commit/5cfc20c2729f46d789b053781db9f74229a373d1