首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >qTip没有用于动态内容的“qtip”方法

qTip没有用于动态内容的“qtip”方法
EN

Stack Overflow用户
提问于 2013-11-19 07:26:33
回答 1查看 593关注 0票数 1

我的系统里有这个接口。

我为所有成功的-[]失败-[]链接分配类mailListBtn。当用户单击成功-[]Failed[]时,它将调用这个js代码。

代码语言:javascript
复制
$(".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()码

代码语言:javascript
复制
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()函数的基础上添加了这段代码。

代码语言:javascript
复制
if($.fn.qtip)
    alert("Function exist");
else
    alert("Function not exist"); 

结果是对于第一个内容,它警告“函数存在”,而不是我悬停在图标和qTip显示。比我点击另一个成功-[]失败-[]检索另一个内容,我得到警告“函数不存在”。我的问题是,在我们使用它之后,qTip是否删除了它们的功能?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-11-19 11:19:33

this post中找到解决我的问题的方法

问题在于我的qTip页面。我有js脚本,并在我的qTip页面中包含js文件。删除这个或将其放在初始页面中将解决问题。

谢谢。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20065580

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档