我的系统里有这个接口。

我为所有成功的-[]失败-[]链接分配类mailListBtn。当用户单击成功-[]Failed[]时,它将调用这个js代码。
$(".mailListBtn").click(function(){
var currentId = $(this).attr('id');
currentId = currentId.split("_"); //Need to split because ID like MCBTN_13
var actualId = currentId[1];
if($("#C_"+actualId).is(":visible"))
$("#C_"+actualId).hide("slow","swing");
$("img#LOADER_"+actualId).show();
var dataString ="action=getMailListByID"+
"&mailID="+actualId;
$.ajax({
type: "POST",
url: "include/get.php",
data: dataString,
cache: false,
async: true,
success: function(html)
{
$("#SPAN_"+actualId).empty();
$("#SPAN_"+actualId).append(html);
$("#C_"+actualId).show("slow","swing");
$("img#LOADER_"+actualId).hide();
if($("#C_"+actualId).is(":visible"))
$("#CC_"+actualId).show();
else
$("#CC_"+actualId).hide();
reQtip();
}
});
});reQtip()码
function reQtip()
{
$("img[rel*='template/qTipUpdateContact.php?refID=']").each(function()
{
$(this).qtip({
content: {
text: '<img class="throbber" src="images/loader.gif" alt="Loading..." />',
ajax: {
url: $(this).attr('rel'),
once: false
},
title: {
text: 'UPDATE CONTACT INFO FOR NEWSSID - ' + $(this).attr('title'),
button: true
}
},position: {
at: 'middle left', // Position the tooltip above the link
my: 'right middle',
viewport: $(window), // Keep the tooltip on-screen at all times
effect: false // Disable positioning animation
},
show: {
event: 'click mouseenter',
solo: true // Only show one tooltip at a time
},
hide: {
event: 'click'
},
style: {
classes: 'qtip-dark'
}
});
});
}如果您可以看到,在内容加载成功后,我调用reQtip()函数,以便具有qTip的内容为每个元素激活qTip。内容如下:-

如您所见,鼠标悬停在绿色按钮上将弹出qTip,如下所示:

问题是,当我第一次点击成功-失败-4内容显示和qTip功能正常。比我点击成功-4失败-9内容显示,但qTip错误。google中检查代码的错误是Uncaught : Object没有方法'qtip'。关于您的信息,我已经在我的php页面中包含了qTip js文件。为什么qTip只能针对第一个内容运行,而在第二个内容上出现错误。
我试图检测qTip函数是否存在。为此,我在reQtip()函数的基础上添加了这段代码。
if($.fn.qtip)
alert("Function exist");
else
alert("Function not exist"); 结果是对于第一个内容,它警告“函数存在”,而不是我悬停在图标和qTip显示。比我点击另一个成功-[]失败-[]检索另一个内容,我得到警告“函数不存在”。我的问题是,在我们使用它之后,qTip是否删除了它们的功能?
发布于 2013-11-19 11:19:33
https://stackoverflow.com/questions/20065580
复制相似问题