Skip to content

Instantly share code, notes, and snippets.

@yuheiy
Last active January 15, 2018 04:27
Show Gist options
  • Save yuheiy/e10b507442c865e889a926b9f1d5cde8 to your computer and use it in GitHub Desktop.
Save yuheiy/e10b507442c865e889a926b9f1d5cde8 to your computer and use it in GitHub Desktop.
import Hammer from 'hammerjs'
const hammer = new Hammer(backdropEl, { touchAction: 'auto' })
hammer.get('pinch').set({ enable: true })
let isPinching = false
hammer.on('pinchstart', () => {
isPinching = true
})
hammer.on('pinchend', () => {
isPinching = false
})
backdropEl.addEventListener('touchmove', (ev) => {
if (!isPinching) {
ev.preventDefault()
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment