I am including additional HTML content upon clicking a "load more" button using the following JavaScript function:
function addStuff() {
$.get('page-partials/more-stuff.html', function(stuff) {
$('#load-button').append(stuff);
});
};
The issue I'm encountering is that this new content is inserted into a container with a varying height, and I would like to animate it downwards as more items are added. To achieve this effect, I need to assign a dynamic class to the divs inside 'more-stuff.html' every time that template is appended.
For example:
<div class='stuff added1'></div>
Subsequently, on the next iteration:
<div class='stuff added2'></div>
Is there a way to accomplish this? Alternatively, does anyone have suggestions for animating changes in height from an unknown nonzero value to another unknown nonzero value?