iNoBounce
iNoBounce copied to clipboard
Horizontal scrolling not possible when vertically scrolled to top or bottom
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 @dhelbig fixed. see here
@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.
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.
The fix from #14 didn't seem to do it. If someone wants to work on another approach I'm happy to review it.
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.
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.
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)
@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.
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?