2009-10-14 24 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

相關問題