sticky-kit icon indicating copy to clipboard operation
sticky-kit copied to clipboard

Suggestion: change "scroll < top" to "scroll <= top" on line 140

Open brandonpeat opened this issue 8 years ago • 1 comments

Apologies, I'm a Github newbie, this is probably the wrong forum in which to offer suggestions?

In "jquery.sticky-kit.js" I suggest changing line 140 from if (scroll < top) { to if (scroll <= top) {.

If like me you're using Sticky-Kit to stick a header at the very top of your screen and change its CSS on scrolling (like #header{background:#fff} #header.is_stuck{background:#000} or some such), the "is_stuck" class applies on scroll but is never removed when you scroll back to the top. It's on that header permanently until you reload. The above tweak solved my issue.

I'm not a jquery expert so maybe there's a reason for the existing method I've overlooked? Thanks!

brandonpeat avatar May 24 '17 18:05 brandonpeat

Aha, looks like somebody beat me to it: https://github.com/leafo/sticky-kit/pull/117

brandonpeat avatar May 24 '17 18:05 brandonpeat