2009-10-14 21 views
1

我通过AJAX在html中加载并将其附加到DIV,但我希望能够选择新加载的html并应用hide()。fadeIn( )添加到新添加的html中的元素。当新的HTML被加载到#comments我希望能够仅在这些节点褪色如何将效果仅应用于新添加的节点(jQuery)

电流功能看起来像这样

wall = new Object(); 

wall.showWall = function (options) { 
    // Use this to initiate the comment wall 
    $.ajax({ 
     url: "activity_results.html?"+options, 
     cache: false, 
     success: function(html){ 
      $("#comments .loader").hide(); // The wall's comment spinner 
      requestStuff.showResponse(); // Trigger the addComment function 
      if (!options){ // Make sure we are not paging 
       wall.showMore(); 
      } 
      $("#comments").append(html).hide().fadeIn("slow"); 
     } 
    }); 

} 

回答

0

而不是追加到#comments创建一个隐藏的div里面,并将其附加到该div。

Then fadeIn that hidden div。

0
$(html).appendTo("#comments").hide().fadeIn("slow"); 
+1

我不知道你可以将html内容作为选择器传递给$ ...真的吗? – psychotik 2009-10-14 02:12:22

+0

不幸的是,这种效果并没有像这样得到应用,它只是附加并立即显示。 – Simon 2009-10-14 17:07:49

+0

什么是'html'? – 2011-08-22 06:03:50

相关问题