iNoBounce icon indicating copy to clipboard operation
iNoBounce copied to clipboard

Horizontal scrolling not possible when vertically scrolled to top or bottom

Open lazd opened this issue 11 years ago • 10 comments

If an element allows both horizontal and vertical scrolling, it is not possible to scroll horizontally if the element is scrolled to either the top or bottom.

lazd avatar Jan 07 '14 02:01 lazd

@lazd @dhelbig fixed. see here

robertu7 avatar Apr 13 '15 13:04 robertu7

@RoberMac I'm still having this issue after merging your fix. See the new example https://github.com/lazd/iNoBounce/blob/master/examples/xy.html

When scrolled to the top or the bottom, I still can't scroll horizontally. I tried moving the Handle Y and Handle X blocks, but then I can't scroll vertically.

lazd avatar Nov 13 '15 19:11 lazd

I've got an element with horizontal scrolling only, which means that vertically it's on top and bottom all the time. The script blocked scrolling completely in this element.

subhog avatar Jan 16 '16 01:01 subhog

The fix from #14 didn't seem to do it. If someone wants to work on another approach I'm happy to review it.

lazd avatar Mar 16 '16 19:03 lazd

I have the same problem... This works with event.preventDefault() to stop the default annoying iOS overflow bounce (probably the only way to stop this behavior...) Since we are preventing the whole event, there is no way of allowing the native horizontal scrolling at the same we block the vertical. A workaround idea could be to use preventDefault and apply the horizontal scroll manually, although this will never be smooth as the native scroll at least the interface gets usable.

clopezdepablo avatar Apr 26 '16 21:04 clopezdepablo

There are some potential solutions where you measure the direction the touch is moving, but I don't have time to implement them. Definitely interested in reviewing if others want to take a crack at it again.

lazd avatar Apr 26 '16 23:04 lazd

I am currently experiencing the same problem.

@lazd could you elaborate on that? Measuring the direction sounds like a doable task, but what then?

While trying to find a solution it came apparent, that event.preventDefault is a problematic solution here, since it is not possible to selectively prevent only on one axis.

It would theoretically be possible to preventDefault if the user has any movement exceeding the bounds, but in practice on an element that is only scrollable along X a user would never scroll in a perfectly horizontal line.

Any ideas? (It would be nice to just cancel out the respective part of movement in the event args and continue event bubbling with the modified args but AFAIK that is not possible)

ScallyGames avatar Feb 01 '17 15:02 ScallyGames

@Aides359 the problem is, we cannot allow scrolling of any kind when at the top or bottom of the element, because it may result in bounce. Now, if we allowed scrolling for a couple pixels, then did a preventDefault if the delta was in the X direction.

lazd avatar Feb 01 '17 16:02 lazd

I absolutely see that problem. Any non-blocked scrolling in Y will cause bounce in that scenario.

Is the bottom line that we (at least currently) can't do anything about it?

ScallyGames avatar Feb 02 '17 07:02 ScallyGames