【问题标题】:qTip and .Live() dataqTip 和 .Live() 数据
【发布时间】:2010-11-12 10:48:44
【问题描述】:

简而言之, 我目前正在显示结果列表...然后我在结果上放置一个过滤器并使用 jQuery 中的 .live() 拉出另一个结果列表。

当我使用 qTip 时,不是我的问题。目前运行有点像这样......没有所有细节。

$('.contact').each(function() {
   $(this).qtip({
      // These are my options within here
   });
});

如果我的代码使用 .live() 功能过滤我的结果。

$('.filterContacts').live('click', function(){
    var filterId = $(this).attr('id');  

    $.ajax({
    url: 'classes/class.Post.php?a=filterContacts',
    dataType: 'html',
    data: {
        filter: filterId 
    },
    success: function (responseText) {
        $(".contacts").html(responseText);
    },
    error: function() {
        alert("Oops... Looks like we're having some difficulties.");  
    }
    });
    return false;
});

所以现在我的 qTip 不喜欢处理我的过滤结果...有什么我可以做的吗?任何帮助将不胜感激!

更新: .contacts 是一个包含所有 .contact div 的 div。 IE:

<div class="contacts">
  <div class="contact">FistName, LastName</div>
  <div class="contact">FistName, LastName</div>
  <div class="contact">FistName, LastName</div>
</div>

【问题讨论】:

  • @justin 那里的联系人和联系人都很好。
  • 联系人里面有联系人类吗
  • 嗨,州长,我已经更新了我的问题以回应您的 cmets...
  • @justin,你什么时候执行这段代码 each(function()
  • 您需要在成功函数中执行该操作,以便 html 届时准备就绪。

标签: filtering jquery qtip


【解决方案1】:

您应该在成功块中执行您的代码。

$('.filterContacts').live('click', function(){
        var filterId = $(this).attr('id');  

        $.ajax({
        url: 'classes/class.Post.php?a=filterContacts',
        dataType: 'html',
        data: {
            filter: filterId 
        },
        success: function (responseText) {
            $(".contacts").html(responseText);
            // call your each function here...
    $('.contact').each(function() {
       $(this).qtip({
          // These are my options within here
       });
    });


        },
        error: function() {
            alert("Oops... Looks like we're having some difficulties.");  
        }
        });
        return false;
    });

【讨论】:

  • @justin ,您尝试过上述方法吗?
  • 哈!你真是天才!漂亮,谢谢你的澄清!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-03-27
  • 1970-01-01
  • 2012-03-08
相关资源
最近更新 更多