matthewp / position--sticky-

Polyfill for position: sticky;
175 stars 40 forks source link

Add "stuck" class when position:sticky used #6

Closed AlecRust closed 9 years ago

AlecRust commented 11 years ago

I like how your JS fallback includes a handy .stuck class, activated when the element becomes stuck.

Would be great if this was also added via JavaScript when position: sticky was actually used, would this be possible?

I've also opened a StackOverflow question about this here: http://stackoverflow.com/questions/16302483/event-when-positionsticky-is-triggered

matthewp commented 11 years ago

Hi, I guess I'm not understanding the request. .stuck is always added when a stylesheet contains 'position: sticky;'. Am I missing anything?

AlecRust commented 11 years ago

From my testing the .stuck class is added when the polyfill is triggered - not when the real position: sticky CSS property is used (Chrome Canary). Was wondering if it's possible to add this .stuck class even when the real position: sticky is used.

matthewp commented 11 years ago

Ah, I understand. Yes, for consistency that would make sense. Let me see how difficult that would be to implement.