Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Horizontal scrolling not possible when vertically scrolled to top or bottom #2

Open
lazd opened this issue Jan 7, 2014 · 10 comments · Fixed by #14
Open

Horizontal scrolling not possible when vertically scrolled to top or bottom #2

lazd opened this issue Jan 7, 2014 · 10 comments · Fixed by #14
Labels

Comments

@lazd
Copy link
Owner

lazd commented Jan 7, 2014

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.

robertu7 pushed a commit to robertu7/iNoBounce that referenced this issue Apr 13, 2015
@robertu7
Copy link
Contributor

@lazd @dhelbig fixed. see here

robertu7 pushed a commit to robertu7/iNoBounce that referenced this issue Sep 13, 2015
@lazd lazd closed this as completed in #14 Nov 13, 2015
lazd added a commit that referenced this issue Nov 13, 2015
Fix #2 issue: horizontal can't scrolling
@lazd lazd reopened this Nov 13, 2015
@lazd
Copy link
Owner Author

lazd commented Nov 13, 2015

@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.

@subhog
Copy link

subhog commented Jan 16, 2016

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.

@lazd
Copy link
Owner Author

lazd commented Mar 16, 2016

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

@clopezdepablo
Copy link

clopezdepablo commented Apr 26, 2016

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.

@lazd
Copy link
Owner Author

lazd commented Apr 26, 2016

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.

@ScallyGames
Copy link

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)

@lazd
Copy link
Owner Author

lazd commented Feb 1, 2017

@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.

@ScallyGames
Copy link

ScallyGames commented Feb 2, 2017

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
@lazd @subhog @clopezdepablo @ScallyGames @robertu7 and others