zigotica / scrollSnapPointsPolyfill

CSS scroll Snap Points Polyfill
46 stars 4 forks source link

Flickering when slightly overscrolling #2

Open ckrack opened 8 years ago

ckrack commented 8 years ago

When i scroll slightly over a snap-point, this polyfill will go with the scroll, displaying the a part of the content that is further than the next snap-point and then snap back to the closest snap-point.

For example, i scroll down 2 1/4 elements. I then see the 3rd element. The scroll-snap is at the beginning of the 2nd element though. The polyfill thus is moving back there, but does so with a flickering. It goes back too far, then comes to a rest at the right position.

In Safari it appears to always go down to the next snap-point in the direction of scrolling. This prevents the flickering and is a more natural feel.

Browser: Chrome 46, but it's a general issue

ckrack commented 8 years ago

I have fixed this and other issues in ckrack/scrollsnap-polyfill. I'm using a different approach there, which parses CSS values, supports more of the spec and includes smooth scrolling.