From 419fe808ee5bf6ff651711baf297206c4b79fd78 Mon Sep 17 00:00:00 2001 From: ShmidtIvan Date: Mon, 9 Jun 2014 15:47:53 +0400 Subject: [PATCH] Update modals.js Added click handler for desktop compatibility --- js/modals.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/js/modals.js b/js/modals.js index 3e349b0..3bcf8b9 100644 --- a/js/modals.js +++ b/js/modals.js @@ -28,14 +28,18 @@ return document.querySelector(modalToggle.hash); } }; - - window.addEventListener('touchend', function (event) { + + var openModal = function (event) { var modal = getModal(event); if (modal) { if (modal && modal.classList.contains('modal')) { modal.classList.toggle('active'); } + $(window).trigger("modalOpened", {smth:modal}); event.preventDefault(); // prevents rewriting url (apps can still use hash values in url) } - }); -}()); + }; + //Added click for desktop compatibility + window.addEventListener('click', openModal); + window.addEventListener('touchend', openModal); +})();