Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/ratchet.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dist/js/ratchet.js')
-rw-r--r--dist/js/ratchet.js21
1 files changed, 11 insertions, 10 deletions
diff --git a/dist/js/ratchet.js b/dist/js/ratchet.js
index 97fbd92..7defe2c 100644
--- a/dist/js/ratchet.js
+++ b/dist/js/ratchet.js
@@ -76,14 +76,6 @@
!(function () {
'use strict';
- var eventModalOpen = new CustomEvent('modalOpen', {
- bubbles: true,
- cancelable: true
- });
- var eventModalClose = new CustomEvent('modalClose', {
- bubbles: true,
- cancelable: true
- });
var findModals = function (target) {
var i;
var modals = document.querySelectorAll('a');
@@ -107,9 +99,18 @@
window.addEventListener('touchend', function (event) {
var modal = getModal(event);
if (modal && modal.classList.contains('modal')) {
- var eventToDispatch = eventModalOpen;
+ var eventToDispatch = null;
if (modal.classList.contains('active')) {
- eventToDispatch = eventModalClose;
+ eventToDispatch = new CustomEvent('modalClose', {
+ bubbles: true,
+ cancelable: true
+ });
+ }
+ else {
+ eventToDispatch = new CustomEvent('modalOpen', {
+ bubbles: true,
+ cancelable: true
+ });
}
modal.dispatchEvent(eventToDispatch);
modal.classList.toggle('active');