Closed quantumwebco closed 4 years ago
Hi @quantumwebco,
thanks for reporting this. Can you also provide a codepen that reproduces this?
@DanielRuf
Here is an example of the issue. I'll try set up a codepen soon as I get a minute!
Thanks a lot
Here's a codepen of the issue
https://codepen.io/quantumweb/pen/dyyyqQq
Notice also that also after scrolling down a ways then it does add the js-is-stuck at which point it no longer sticks to the top
Thanks!
I'm having this issue too. No js class on pageload.
Also, .js-is-sticky--change
removes at the bottom of the page I'm on.
I'm having this issue too.
I too, am having this issue
The problem is that the manageState
function isn't being called in the constructor, only on scroll.
A workaround for this problem would be to trigger the scroll event on the scroll element. If you don't need to support IE11 (or you have the necessary polyfills) you can use CustomEvent
.
el.dispatchEvent(new CustomEvent('scroll'))
Or if you need IE11 support you can probably just scroll up and down one pixel.
window.scrollTo(window.scrollX, window.scrollY - 1);
window.scrollTo(window.scrollX, window.scrollY + 1);
Triggering scroll events taken from this Stack Overflow post.
I think I fixed the problem in #658, if not then please tell me and I'll take another look!
stickybits: 3.6.7 Windows: 10 Chrome: 77.0.3865.90 (Official Build) (64-bit) FF: 69.0.2 (64-bit)
Hey I'm really sorry I know this has been posted before and there is lots of discussion around it and I see reference to fixes in version 2.x but using version 3.6.7 I'm still having issues.
When I refresh the page scrolled halfway, the classes aren't added on page load. Only when I scroll.
If starting from the top, the class
.js-is-sticky
is added immediately on scroll, before the element reaches the top of the viewportWhen the element is roughly it's own height away from the top of the viewport it adds
js-is-sticky--change
No other classes are added
I looked at the update() method in the docs but can't see anything that helps.
My markup is
JS
Many thanks