Skip to content

Instantly share code, notes, and snippets.

@parshap
Last active August 29, 2015 14:12
Show Gist options
  • Save parshap/163f3c72fc2655e1702b to your computer and use it in GitHub Desktop.
Save parshap/163f3c72fc2655e1702b to your computer and use it in GitHub Desktop.
this.prevScrollTop = scroll.getScrollTop();
this.prevScrollLeft = scroll.getScrollLeft();
this.prevOverflow = window.document.body.style.overflow;
window.document.body.style.overflow = "hidden";
window.scrollTo(0, 0);
window.document.body.style.marginTop = px(-this.prevScrollTop);
window.document.body.style.marginLeft = px(-this.prevScrollLeft);
window.document.body.style.height = px(getWindowHeight() + this.prevScrollTop);
window.document.body.style.width = px(getWindowWidth() + this.prevScrollLeft);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment