this.template = this.options.template ? $(this.options.template) : this._buildTemplate(elemId);
this.template.appendTo(document.body)
- .text(this.options.tipText)
+ .html(this.options.tipText)
.hide();
this.$element.attr({
}
})
.on('mouseleave.zf.tooltip', function(e) {
- clearTimeout(_this.timeout);
- if (!isFocus || (_this.isClick && !_this.options.clickOpen)) {
- _this.hide();
- }
+ 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();
+ }
+ }
});
}
this.$element.on('mousedown.zf.tooltip', function(e) {
e.stopImmediatePropagation();
if (_this.isClick) {
- _this.hide();
+ //_this.hide();
// _this.isClick = false;
} else {
_this.isClick = true;
* @option
* @example 12
*/
- hOffset: 12
+ hOffset: 12,
+ /**
+ * Should the tip remain open if hover
+ * @option
+ * @example false
+ */
+ tipHoverable: false
};
/**