q提示:防止连续隐藏尖端两次

时间:2011-09-29 22:11:25

标签: javascript qtip

首先抱歉在这里发布问题。 support forum似乎已经快死了。

所以我遇到了qtip插件或我的代码中的错误。当我连续两次或多次致电.qtip('hide')时,工具提示会隐藏,并且在调用.qtip('show')时再也不会显示。

重现方式:

el.qtip('hide');el.qtip('hide');el.qtip('show'); \\ -> bug, the tip is not shown el.qtip('hide');el.qtip('hide');el.qtip('hide');el.qtip('show'); \\ -> bug, same

连续show效果很好......

el.qtip('show');el.qtip('show');el.qtip('hide');el.qtip('show'); \\ -> pass

非连续hide也很有效:

el.qtip('hide');el.qtip('show');el.qtip('hide');el.qtip('show'); \\ -> pass

问题是:

如何让事情奏效? qTip api不会让我找到隐藏或显示提示的方法。我怎么知道?我可以检查是否隐藏了qTip而不是隐藏它两次。

可能的问题来源:

导致错误的qtip以相当棘手的方式构建:

qtip({
            content: text,
            position: {
                corner: {
                    target: 'rightMiddle',
                    tooltip: 'leftMiddle'
                }
            },
            style: {
                tip: {
                     corner: 'leftMiddle',
                },
                border: {
                    radius: 11,
                    width: 4
                },
                name: 'red'
            },
            show: {
                delay:0,
                ready: true,
                fixed:true,
                when: { target: false, event:false },
                effect: function() {//.stop(true, true)
                    $(this).effect("drop", { direction: "down", mode: "show" }, 240)
                }
            },
            hide: {
                delay:0,
                fixed:true,
                when: { target: false, event:false },
                effect: function() {//.stop(true, true)
                    $(this).effect("drop", { direction: "down", mode: "hide" }, 240)
                }
            }
        })

要对此进行测试,您可以访问www.buxdial.com/oldo/register.php,在验证码字段中输入任何内容,转到调试器并运行测试,将el替换为code.TIP

1 个答案:

答案 0 :(得分:0)

如果您的网页上只有一个qtip实例,则可以通过搜索qtip-active课程来查看当前是否显示qtip。以下是使用jquery如何检查的示例:

if($('div.qtip-active').length) {
   alert("qtip is currently showing");
}
else {
   alert("qtip is hidden");
}
相关问题