qTip2隐藏空内容

时间:2012-06-11 14:20:44

标签: javascript jquery qtip2

我从自定义标记data-tooltip加载工具提示的文本。如果数据工具提示不存在,我希望隐藏工具提示。这可能吗?

示例jsfiddle

1 个答案:

答案 0 :(得分:2)

试试这个:

$(document).ready(function() {
    $('#menu a').qtip({
        content: {
            attr: "data-tooltip"
        }
    });
});

qtip2文档说这是使用“text”而不是“attr”:

Custom functions that return no valid content will still cause the tooltip to be created! Replace these with an each() loop if this is not the desired behaviour.

如果你看一下“attr”的使用,它会说:

If no valid content is found within the elements attribute, and content.text is not defined, no tooltip will be rendered.