【发布时间】:2013-11-27 19:52:03
【问题描述】:
我正在使用 jQuery 和 Tooltipster(在悬停用户名时显示工具提示),它们运行良好 除了一种情况:当我第一次悬停用户名时,它不会显示.
<div class="user">Firstname Lastname</div>
这是我的 jQuery 代码:
$(document).ready(function() {
$(document).on('mouseover', '.user', function() {
// Tooltip for EC user
$('.evac_user').tooltipster({
animation : 'fade',
delay : 0,
content : 'Loading...',
functionBefore : function(origin, continueTooltip) {
continueTooltip();
// next, we want to check if our data has already been cached
if (origin.data('ajax') !== 'cached') {
$.ajax({
type : 'GET',
url : "/myfunction",
success : function(data) {
// update our tooltip content with our returned data and cache it
origin.tooltipster('update', data).data('ajax', 'cached');
}
});
}
}
});
});
});
【问题讨论】:
-
解释发生了什么问题并提供小提琴 svp
-
我已经解释了我的问题出了什么问题,我不能提供一个小提琴,因为它使用 ajax + 一个外部 jQuery 插件...
-
不,你不是说过:
which are working great except for one situation : when I first go hover a user name.将鼠标悬停在用户名上时出了什么问题 -
另外,模仿小提琴中的 ajax 并不难 - 只需更新
setTimeout中的内容 -
谢谢,我已经编辑了我的问题,希望这样清楚。我不知道如何制作小提琴。
标签: javascript jquery tooltipster