From 31ad664cd2e90a20d1fdb526c7e98e7807172351 Mon Sep 17 00:00:00 2001 From: dethe Date: Tue, 17 Mar 2015 23:19:15 -0700 Subject: [PATCH 1/2] fix for #4 --- nanomodal.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/nanomodal.js b/nanomodal.js index bb25fa5..dc9023b 100644 --- a/nanomodal.js +++ b/nanomodal.js @@ -42,12 +42,19 @@ function El(tag, classNames) { } }; + +}); var addClickListener = function(handler) { - if ("ontouchend" in document.documentElement) { - addListener("touchstart", handler); - } else { - addListener("click", handler); + var flag = false; + var wrappedHandler = function(evt){ + if (!flag){ + flag = true; + setTimeout(function(){ flag = false; }, 100); + handler(evt); + } } + addListener("touchstart", wrappedHandler); + addListener("click", wrappedHandler); }; var show = function(arg) { @@ -371,7 +378,7 @@ var ModalEvent = require("./ModalEvent"); var nanoModalAPI = (function() { - + var El = require("./El"); var Modal = require("./Modal"); From 5ef79d5d198ae0f66582d86c1407e50f99fada27 Mon Sep 17 00:00:00 2001 From: dethe Date: Wed, 18 Mar 2015 09:25:26 -0700 Subject: [PATCH 2/2] remove typo / syntax error --- nanomodal.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nanomodal.js b/nanomodal.js index dc9023b..70b49f3 100644 --- a/nanomodal.js +++ b/nanomodal.js @@ -42,8 +42,6 @@ function El(tag, classNames) { } }; - -}); var addClickListener = function(handler) { var flag = false; var wrappedHandler = function(evt){ @@ -54,7 +52,7 @@ function El(tag, classNames) { } } addListener("touchstart", wrappedHandler); - addListener("click", wrappedHandler); + addListener("mousedown", wrappedHandler); }; var show = function(arg) {