Skip to content

Instantly share code, notes, and snippets.

@dbismut
Last active April 9, 2018 08:06
Show Gist options
  • Save dbismut/c4c76e33ed6bc52a356368f00638c904 to your computer and use it in GitHub Desktop.
Save dbismut/c4c76e33ed6bc52a356368f00638c904 to your computer and use it in GitHub Desktop.
Part 2 - Adding scrollTop values to this.from and this.to
onExit = () => {
// we don't want to run this if there is no
// preview element to transition to.
if (!this.preview) return;
this.from = {
top: 0,
height: this.post.offsetHeight,
width: this.post.offsetWidth,
borderRadius: this.postStyler.get('borderRadius'),
scrollTop: windowScroll.get('top') // add this
};
// change this
this.to = {
...this.getPreviewStyleAndPosition(),
scrollTop: 0
};
const scrollTop = windowScroll.get('top');
this.post.classList.add('scroll-block');
this.postScroll.set('top', scrollTop);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment