$(window).on('mousemove', function (e) {
if ($this.type === 'keyboard') {
$this.type = 'mouse';
- $this.hideTooltip();
+ $this.hideTooltip('mousemove');
}
$this.updateMousePosition(e);
});
$(document).on(this.fluidbook.input.hoverEvent, '[data-tooltip]', function (e) {
- $this.type = 'mouse';
- $this.updateMousePosition(e);
- $this.eventTriggered(this);
+ if (!$this.fluidbook.input.isUsingTouch()) {
+ $this.type = 'mouse';
+ $this.updateMousePosition(e);
+ $this.eventTriggered(this);
+ }
});
+
+ $(document).on('click', '[data-tooltip]', function (e) {
+ if ($this.fluidbook.input.isUsingTouch()) {
+ $this.type = 'touch';
+ $this.updateMousePosition(e);
+ $this.eventTriggered(this);
+ }
+ });
+
$(document).on('focus', '[data-tooltip],[data-keyboard-tooltip]', function (e) {
if ($('body').hasClass('keyboard-navigating')) {
$this.type = 'keyboard';
}
});
$(document).on('blur', '[data-tooltip],[data-keyboard-tooltip]', function (e) {
- $this.hideTooltip();
+ $this.hideTooltip('blur');
});
$(document).on(this.fluidbook.input.clickEvent, '[data-tooltip-hide-on-click]', function () {
- $this.hideTooltip();
+ $this.hideTooltip('hide on click');
});
$("body").append('<div id="tooltip" role="tooltip"></div>');
var maxy = this.fluidbook.resize.hh - h;
$("#tooltip").attr('data-pos-x', x).attr('data-pos-y', y).css({
- top: Math.max(1, Math.min(top, maxy)),
- left: Math.max(1, Math.min(left, maxx))
+ top: Math.max(1, Math.min(top, maxy)), left: Math.max(1, Math.min(left, maxx))
});
},
if (fluidbook.input.isUsingTouch()) {
$(document).one("touchstart", function () {
- $this.hideTooltip();
+ $this.hideTooltip('touchstart');
});
} else {
$(target).one('mouseout', function () {
- $this.hideTooltip();
+ $this.hideTooltip('mouseout');
});
}
this.displayTooltip(text, style, css);
let $this = this;
setTimeout(function () {
- $this.hideTooltip();
+ $this.hideTooltip('afterDuration');
}, duration);
},
displayTooltip: function (text, style, css) {
+ console.log('displayTooltip', text, style, css);
if (text === '-') {
- return this.hideTooltip();
+ return this.hideTooltip('before displayTooltip');
}
if ($('.fixedTooltip:visible').length > 0) {
return;
this.updateTooltipPosition();
return true;
},
- hideTooltip: function () {
+
+ hideTooltip: function (where) {
+ console.log('hide tooltip', where);
$("#tooltip").hide().text('');
},
+
showFixedTooltip: function (e, posX, posY, css) {
- this.hideTooltip();
+ this.hideTooltip("beforeFixedTooltip");
$(e).attr('data-pos-x', posX).attr('data-pos-y', posY).css(css).show();
$(document).one(this.fluidbook.input.clickEvent, '*', function () {
$(e).hide();