How to apply effects to only newly appended nodes (jQuery)
I am loading in html via AJAX and appending it to a DIV but I want to be able to select the newly loaded in html and apply a hide().fadeIn() to elements in that newly appended html.
Current function looks something like this
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.showRes开发者_如何学运维ponse(); // Trigger the addComment function
if (!options){ // Make sure we are not paging
wall.showMore();
}
$("#comments").append(html).hide().fadeIn("slow");
}
});
}
When new html gets loaded into #comments I want to be able to only fade in those nodes.
Instead of appending to #comments
create a hidden div inside of it and append it to that div.
Then fadeIn
that hidden div.
$(html).appendTo("#comments").hide().fadeIn("slow");
精彩评论