From cd308c29f6bbf74eda8c7ea5aac9ca3bc5b5e61b Mon Sep 17 00:00:00 2001 From: Nadir Kadem Date: Mon, 4 Nov 2013 11:32:04 +0100 Subject: [PATCH] Better support for target --- src/javascripts/jquery.tipsy.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/javascripts/jquery.tipsy.js b/src/javascripts/jquery.tipsy.js index 7b095b9..ef9c606 100644 --- a/src/javascripts/jquery.tipsy.js +++ b/src/javascripts/jquery.tipsy.js @@ -97,26 +97,25 @@ getTitle: function() { var title, $e = this.$element, o = this.options; + this.fixTitle(); + var title, o = this.options; - if (typeof o.target == 'string') + if (o.target) { o.html = true; o.interactive = true; o.delayOut = 100; - title = $(o.target).html(); + title = $j(o.target).hide().html(); } else { - this.fixTitle(); - var title, o = this.options; if (typeof o.title == 'string') { title = $e.attr(o.title == 'title' ? 'original-title' : o.title); } else if (typeof o.title == 'function') { title = o.title.call($e[0]); } + title = ('' + title).replace(/(^\s*|\s*$)/, ""); } - title = ('' + title).replace(/(^\s*|\s*$)/, ""); - return title || o.fallback; }, @@ -224,7 +223,6 @@ offset: 0, opacity: 1, title: 'title', - target: null, trigger: 'hover', interactive: false };