From 2d40b88fc588d5e91cabb14a6103717438aabeb9 Mon Sep 17 00:00:00 2001 From: Tait Brown Date: Thu, 22 Aug 2013 16:31:36 +1000 Subject: [PATCH] A better version of pull #144 --- src/javascripts/jquery.tipsy.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/javascripts/jquery.tipsy.js b/src/javascripts/jquery.tipsy.js index f95c063..74b0e9a 100644 --- a/src/javascripts/jquery.tipsy.js +++ b/src/javascripts/jquery.tipsy.js @@ -174,10 +174,15 @@ if (!options.live) this.each(function() { get(this); }); if (options.trigger != 'manual') { - var binder = options.live ? 'live' : 'bind', - eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus', + var eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus', eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur'; - this[binder](eventIn, enter)[binder](eventOut, leave); + + if (!options.live) { + this['bind'](eventIn, enter)['bind'](eventOut, leave); + } else { + $(this.context).on(eventIn, this.selector, enter); + $(this.context).on(eventOut, this.selector, leave); + } } return this;