0

所以我希望 qtip 有以下行为:

当我单击对象时,应该会显示 qtip(我可以正常工作)...但是我想让它在几毫秒后消失,而无需我做任何事情....您将如何配置qtip 这样做?

我试过

hide: {
    when : 'inactive',
    delay : 100,
    fixed: false
}

但它不工作....

任何帮助将不胜感激...谢谢

4

3 回答 3

1

如果您只希望工具提示在屏幕上闪烁:

$(".tooltip").qtip({
    content: "Test tooltip",
    api: {
        // As soon as the qtip is fully visible..
        onShow: function (event) {
            // Keep a reference to the qtip..
            that = this;
            // After 1ms (to let things settle down)
            setTimeout(function () {
                // Hide the qtip
                that.hide();
            }, 1); // change this value to have it stay on screen longer
        }
    },
    show: "mouseover"
});
于 2011-02-12T20:01:48.947 回答
0

我认为您的代码是正确的,但是delay会导致问题。100 毫秒只有 0.1 秒,所以可能 qtip 需要比那个时间更长的时间来渲染,当它被告知隐藏自己时它还不存在(只是一个猜测)。

我会增加延迟(无论如何,您可能希望您的用户看到提示几秒钟),看看是否有帮助。这是一个使用 1000 毫秒的示例:http: //jsfiddle.net/andrewwhitaker/dVEYq/

于 2011-02-12T19:04:19.600 回答
0

我知道这是一个老问题,但以防万一有人路过,在 qTip2 中正确的做法是:(事件而不是 api)

events: {
            show: function(event, api){
                var that = this;
                setTimeout(function () {
                   // Hide the qtip
                    that.hide();
                }, 3000); // change this value to have it stay on screen longer
            }
        }
于 2014-04-14T01:18:21.973 回答