From 686ec330ab888b8a0f672908cd9da8c2fb495eef Mon Sep 17 00:00:00 2001 From: Corey Snyder Date: Tue, 3 May 2016 14:52:40 -0400 Subject: [PATCH] changes to tooltip default behavior --- js/foundation.tooltip.js | 38 +++++++------------------------------- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/js/foundation.tooltip.js b/js/foundation.tooltip.js index 1998979f0..02fbd5461 100644 --- a/js/foundation.tooltip.js +++ b/js/foundation.tooltip.js @@ -40,7 +40,7 @@ class Tooltip { this.template = this.options.template ? $(this.options.template) : this._buildTemplate(elemId); this.template.appendTo(document.body) - .html(this.options.tipText) + .text(this.options.tipText) .hide(); this.$element.attr({ @@ -248,28 +248,10 @@ class Tooltip { } }) .on('mouseleave.zf.tooltip', function(e) { - if (_this.options.tipHoverable) { - _this.timeout = setTimeout(function () { - clearTimeout(_this.timeout); - if ($template.is(":hover")) { - $template.on('mouseleave', function (e) { - if (!isFocus || !_this.isClick && _this.options.clickOpen) { - _this.hide(); - } - $template.off('mouseleave'); - }); - } else { - if (!isFocus || !_this.isClick && _this.options.clickOpen) { - _this.hide(); - } - } - }, 200); //min required to capture - } else { - clearTimeout(_this.timeout); - if (!isFocus || !_this.isClick && _this.options.clickOpen) { - _this.hide(); - } - } + clearTimeout(_this.timeout); + if (!isFocus || (_this.isClick && !_this.options.clickOpen)) { + _this.hide(); + } }); } @@ -449,13 +431,7 @@ Tooltip.defaults = { * @option * @example 12 */ - hOffset: 12, - /** - * Should the tip remain open if hover - * @option - * @example false - */ - tipHoverable: false + hOffset: 12 }; /** @@ -465,4 +441,4 @@ Tooltip.defaults = { // Window exports Foundation.plugin(Tooltip, 'Tooltip'); -}(jQuery); +}(jQuery); \ No newline at end of file -- 2.47.2