Skip to content

Commit

Permalink
feat(detach): Simplify detach logic
Browse files Browse the repository at this point in the history
  • Loading branch information
francoischalifour committed Mar 9, 2018
1 parent 10b478d commit 9fa798d
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/medium-zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,20 +248,10 @@ const mediumZoom = (
document.removeEventListener('scroll', onScroll)
document.removeEventListener('keyup', onDismiss)
window.removeEventListener('resize', zoomOut)

target.zoomed &&
target.zoomed.removeEventListener('transitionend', doDetach)
}

if (!target.zoomed) {
doDetach()
} else {
zoomOut()
target.zoomed.addEventListener(
'transitionend',
() => requestAnimationFrame(doDetach)
)
}
target.zoomed && zoomOut()
doDetach()
}

const onClick = event => {
Expand Down

0 comments on commit 9fa798d

Please sign in to comment.