使用livequery在运行时使用jQuery工具提示 [英] Using jQuery tooltip at runtime by livequery

查看:106
本文介绍了使用livequery在运行时使用jQuery工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何在运行时使用livequery使用工具提示吗?我找到了一些信息,但对我来说不起作用.

Does anybody know how to use tooltip at runtime using livequery? I found some infos, but for me it doesnt work.

jQuery('.button').bind('click', function () {
    std();
});

function std () {
    jQuery('.abcd').livequery.run(function() {
        jQuery('.abcd').tooltip();
    });
}

推荐答案

我将您的代码解释为:

单击.button时,您要对所有类别为.abcd的元素启用工具提示功能.如果您打算这样做,请使用

When .button is clicked you want to enable the tooltip functionality on all elements with class .abcd. If this is your intention simply use

jQuery('.button').bind('click', function () {
    std(); //activate tooltip support
});

function std () {
    //internal function is called once for every found/new .abcd element
    jQuery('.abcd').livequery(function() {
        $(this).tooltip();
    });
}

请注意,应该避免多次单击.button,因为这可能导致意外的副作用

Note that probably should prevent .button from being clicked more than once as that could lead to unexpected sideeffects

这篇关于使用livequery在运行时使用jQuery工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆