Browse Source

Prevent modal from triggering while scrolling

pull/643/head
cadrell0 11 years ago
parent
commit
839276784f
  1. 14
      js/modals.js

14
js/modals.js

@ -28,8 +28,22 @@
return document.querySelector(modalToggle.hash); return document.querySelector(modalToggle.hash);
} }
}; };
var dragging = false;
window.addEventListener('touchmove', function () {
dragging = true;
});
window.addEventListener('touchstart', function () {
dragging = false;
});
window.addEventListener('touchend', function (event) { window.addEventListener('touchend', function (event) {
if (dragging) {
return;
}
var modal = getModal(event); var modal = getModal(event);
if (modal) { if (modal) {
if (modal && modal.classList.contains('modal')) { if (modal && modal.classList.contains('modal')) {

Loading…
Cancel
Save