tooltip fixes

This commit is contained in:
Barış Soner Uşaklı
2022-09-11 21:49:30 -04:00
parent 0512992afc
commit a94cc877c4
3 changed files with 12 additions and 23 deletions

View File

@@ -108,6 +108,7 @@
"moderator_tools": "Moderator Tools",
"status": "Status",
"online": "Online",
"away": "Away",
"dnd": "Do not disturb",

View File

@@ -238,25 +238,14 @@ if (document.readyState === 'loading') {
}
app.createUserTooltips = function (els, placement) {
if (isTouchDevice) {
return;
}
els = els || $('body');
els.find('.avatar,img[title].teaser-pic,img[title].user-img,div.user-icon,span.user-icon').one('mouseenter', function (ev) {
const $this = $(this);
const title = $this.attr('title');
if (!title) {
return;
}
// perf: create tooltips on demand
$this.tooltip({
placement: placement || $this.attr('title-placement') || 'top',
title: $this.attr('title'),
if (!isTouchDevice) {
els = els || $('body');
els.tooltip({
selector: '.avatar',
placement: placement || 'top',
container: '#content',
});
// this will cause the tooltip to show up
$this.trigger(ev);
});
}
};
app.createStatusTooltips = function () {

View File

@@ -43,12 +43,11 @@ define('forum/header', [
if (env === 'xs' || env === 'sm' || utils.isTouchDevice()) {
return;
}
$('#header-menu #main-nav li[title]').each(function () {
$(this).tooltip({
placement: 'bottom',
trigger: 'hover',
title: $(this).attr('title'),
});
$('#header-menu #main-nav').tooltip({
selector: '.nav-item',
placement: 'bottom',
trigger: 'hover',
});
}