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

FYI scrolling manipulation on click #4

Open
jensstalder opened this issue Jun 22, 2014 · 0 comments
Open

FYI scrolling manipulation on click #4

jensstalder opened this issue Jun 22, 2014 · 0 comments

Comments

@jensstalder
Copy link

When I have anchors in a scrollable div, tapping on it causes the div do scroll down 1px if its on top. This causes iOS to register a change after tap and initializes a pause until re-tap. This is a behavior of iOS to allow drop downs and the like to function.

utils.scrollToEnd = function (el) {
    var curPos = el.scrollTop, height = el.offsetHeight, scroll = el.scrollHeight;
    // If at top, bump down 1px
    if (curPos <= 0) {
      el.scrollTop = 1; // <<<<< HERE
    }
    // If at bottom, bump up 1px
    if (curPos + height >= scroll) {
      el.scrollTop = scroll - height - 1;
    }
  };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant