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

chrome browser zoom, scroll failure. #5

Open
jaywcjlove opened this issue Sep 7, 2014 · 2 comments
Open

chrome browser zoom, scroll failure. #5

jaywcjlove opened this issue Sep 7, 2014 · 2 comments

Comments

@jaywcjlove
Copy link

Mac osx 10.9.4
chrome version 37.0.2062.94
chrome browser zoom, scroll failure.
_2014-09-08_2_23_58

@nrei0
Copy link

nrei0 commented Nov 16, 2017

Still have a problem.

@nrei0
Copy link

nrei0 commented Nov 16, 2017

Did my own implementation. There can be some optimization tricks. Beside, it should work only on scroll to bottom.

function scrollTo(docEl, to, duration) {
  let t0 = Date.now();
  const diff = (to - docEl.scrollTop);
  const speed = diff / duration;

  const interval = setInterval(() => {
    const t1 = Date.now();
    const delta = t1 - t0;

    docEl.scrollTop += (speed * delta);
    
    if (to - docEl.scrollTop <= 0) {
      docEl.scrollTop = to;
      clearInterval(interval);
      return;
    }

    t0 = t1;
  }, 0);
}

scrollTo(docEl, docEl.scrollTop + top, duration);

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

Successfully merging a pull request may close this issue.

2 participants