From 744084334c6e5cec4b35cc43f04de7f4a98bfcda Mon Sep 17 00:00:00 2001 From: Tobias Vogt Date: Fri, 26 Apr 2013 21:34:03 +0200 Subject: [PATCH] Added posibiliy to close tipsy by tapping it (android/ios) --- src/javascripts/jquery.tipsy.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/javascripts/jquery.tipsy.js b/src/javascripts/jquery.tipsy.js index f95c063..25ea995 100644 --- a/src/javascripts/jquery.tipsy.js +++ b/src/javascripts/jquery.tipsy.js @@ -170,6 +170,16 @@ setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut); } }; + + function taptap(e) { + var tipsy = get(this); + if( tipsy.hoverState == 'in' ) { + leave.call(this); + } else { + enter.call(this); + }t + e.stopImmediatePropagation(); + }; if (!options.live) this.each(function() { get(this); }); @@ -177,6 +187,7 @@ var binder = options.live ? 'live' : 'bind', eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus', eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur'; + this[binder]('click', taptap); this[binder](eventIn, enter)[binder](eventOut, leave); }