I'm using the jQuery UI Tooltip plugin. The tooltip content is generated with AJAX.
The indicator for the tooltips is the <a data-id="" attribute:
<a data-id="137514" title="">Testlink1</a>
I have the problem that I need to hover twice over the link to get the tooltips and its AJAX content loaded. The tooltips and their content should be loaded with the first hover.
I´ve set up a JSFiddle. You can hover over the links to see the loading problem.
jQuery(document).ready(function ($) {
var ajaxManager = $.manageAjax.create('cacheQueue', {
queue: true,
cacheResponse: true
});
$('*[data-id]').hover(function () {
let $tooltip = $(this);
let id = $tooltip.attr("data-id");
ajaxManager.add({
url: "../datenbank/itemscript.php",
type: "GET",
cache: "true",
data: {
"var": id
},
success: function (data) {
$tooltip.tooltip({
tooltipClass: "tooltipitem",
content: data,
hide: {
effect: "slideDown",
delay: 0
},
position: {
my: "left+153 top+20",
collision: "flipfit"
},
});
}
});
});
});