mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-24 18:31:29 +01:00
Try a better implementation of ajax tooltip to avoid all on fast hover
This commit is contained in:
@@ -79,26 +79,48 @@ if (empty($conf->dol_no_mouse_hover)) {
|
|||||||
return $(this).prop("title"); /* To force to get title as is */
|
return $(this).prop("title"); /* To force to get title as is */
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
jQuery(".classforajaxtooltip").tooltip({
|
|
||||||
show: { collision: "flipfit", effect:"toggle", delay:50, duration: 20 },
|
var opendelay = 80;
|
||||||
hide: { delay: 250, duration: 20 },
|
var elemtostoretooltiptimer = jQuery("#dialogforpopup");
|
||||||
|
|
||||||
|
target = jQuery(".classforajaxtooltip");
|
||||||
|
target.tooltip({
|
||||||
tooltipClass: "mytooltip",
|
tooltipClass: "mytooltip",
|
||||||
open: function (event, ui) {
|
show: { collision: "flipfit", effect:"toggle", delay: 0, duration: 20 },
|
||||||
var elem = $(this);
|
hide: { delay: 250, duration: 20 }
|
||||||
var params = JSON.parse($(this).attr("data-params"));
|
});
|
||||||
var currenttoken = jQuery("meta[name=anti-csrf-currenttoken]").attr("content");
|
|
||||||
params.token = currenttoken;
|
target.off("mouseover mouseout");
|
||||||
|
target.on("mouseover", function(event) {
|
||||||
|
console.log("we will create timer for ajax call");
|
||||||
|
var params = JSON.parse($(this).attr("data-params"));
|
||||||
|
var elemfortooltip = $(this);
|
||||||
|
var currenttoken = jQuery("meta[name=anti-csrf-currenttoken]").attr("content");
|
||||||
|
params.token = currenttoken;
|
||||||
|
|
||||||
|
event.stopImmediatePropagation();
|
||||||
|
clearTimeout(elemtostoretooltiptimer.data("openTimeoutId"));
|
||||||
|
elemtostoretooltiptimer.data("openTimeoutId", setTimeout(function() {
|
||||||
|
target.tooltip("close");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url:"'. DOL_URL_ROOT.'/core/ajax/ajaxtooltip.php",
|
url:"'. DOL_URL_ROOT.'/core/ajax/ajaxtooltip.php",
|
||||||
type: "post",
|
type: "post",
|
||||||
async: false,
|
async: true,
|
||||||
data: params,
|
data: params,
|
||||||
success: function(response){
|
success: function(response){
|
||||||
// Setting content option
|
// Setting content option
|
||||||
elem.tooltip("option","content",response);
|
console.log("ajax success");
|
||||||
}
|
elemfortooltip.tooltip("option","content",response);
|
||||||
});
|
elemfortooltip.tooltip("open");
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}, opendelay));
|
||||||
|
});
|
||||||
|
target.on("mouseout", function(event) {
|
||||||
|
console.log("mouse out");
|
||||||
|
event.stopImmediatePropagation();
|
||||||
|
clearTimeout(elemtostoretooltiptimer.data("openTimeoutId"));
|
||||||
|
target.tooltip("close");
|
||||||
});
|
});
|
||||||
';
|
';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2917,7 +2917,7 @@ class Societe extends CommonObject
|
|||||||
|
|
||||||
$result .= $linkstart;
|
$result .= $linkstart;
|
||||||
if ($withpicto) {
|
if ($withpicto) {
|
||||||
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
|
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright' : '').'"'), 0, 0, $notooltip ? 0 : 1);
|
||||||
}
|
}
|
||||||
if ($withpicto != 2) {
|
if ($withpicto != 2) {
|
||||||
$result .= dol_escape_htmltag($maxlen ? dol_trunc($name, $maxlen) : $name);
|
$result .= dol_escape_htmltag($maxlen ? dol_trunc($name, $maxlen) : $name);
|
||||||
|
|||||||
Reference in New Issue
Block a user