jquery-scrollsnap-plugin icon indicating copy to clipboard operation
jquery-scrollsnap-plugin copied to clipboard

body is jumping up and down after snapping to a point

Open amitmoreno opened this issue 12 years ago • 7 comments

Well, I tried many combination of the function, but still, after im scrolling to some snap point it jumps up and down without stopping. any help with that?

amitmoreno avatar Jun 18 '14 02:06 amitmoreno

can you provide more infos: which browser(s), what settings of the plugin, ... ?

On 18 June 2014 04:21, amitmoreno [email protected] wrote:

Well, I tried many combination of the function, but still, after im scrolling to some snap point it jumps up and down without stopping. any help with that?

— Reply to this email directly or view it on GitHub https://github.com/benoitpointet/jquery-scrollsnap-plugin/issues/19.

Liip FR +41 26 422 2511 http://liip.ch

benoitpointet avatar Jun 18 '14 05:06 benoitpointet

I'm experiencing a similar issue with horizontal scrolling, but ONLY if zoom is set to negative (ie. -90%). It will constantly jump/jitter at any snap point. It happens in all browsers I've tested, and have isolated it to your code by process of elimination. If I find a code solution I will post back.

edit: It seems to be a problem with the offset of the matchingEl and the scrollingEl. For some reason unknown to me it detects a 1.6px difference in offset despite each scroll. So i've implemented a tolerance of +/-3px to the if statement so if its in that range it does not scroll. Super hacky, hopefully someone works out why this happens on zoom out.

alecpirillo avatar Jun 26 '14 23:06 alecpirillo

i had to implement a tolerance as well. this only happened on an ipad.

Marvbuster avatar Jul 08 '14 09:07 Marvbuster

It seems to be caused by some number rounding or similar things. Changing line 121 from if ($scrollingElscrollLT != endScroll) { to if ($scrollingElscrollLT != endScroll && Math.abs($scrollingElscrollLT - endScroll)>2) { works for me. Added condition tells that snapping would be ignored if distance is less than 2px. Similar code on line 80 might need to be changed same way too.

Jakkkub avatar Aug 06 '14 12:08 Jakkkub

Correction: In my previous post the first condition is now redundant so if (Math.abs($scrollingElscrollLT - endScroll)>2) { is better.

Jakkkub avatar Aug 06 '14 12:08 Jakkkub

Thanks will integrate that code.

benoitpointet avatar Sep 09 '14 21:09 benoitpointet

fixed in commit https://github.com/benoitpointet/jquery-scrollsnap-plugin/commit/c7fd6e789aa7bcc6aef3dd5c6b75ed4c74ff92de

benoitpointet avatar Sep 16 '14 21:09 benoitpointet