Skip to content

Instantly share code, notes, and snippets.

@user24
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save user24/10624859 to your computer and use it in GitHub Desktop.
Save user24/10624859 to your computer and use it in GitHub Desktop.
// document.body.scrollTop = 1; // uncomment this line and it works every time.
console.log(daysTop); // 15141
console.log($(document).height()); // 54005
document.body.scrollTop = daysTop;
console.log(document.body.scrollTop); // 0, sometimes, in chrome (and the page doesn't move to 15141)....
/*
if I attach the above code to a click handler, then when the bug occurs, it occurs on
every click until I manually scroll the page, then it starts working.
I think it's relevant that the page is only that long because I'm creating new
elements via JS, then trying to scroll to them.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment