You need event delegation:
$(".container").on('click','.contract',function () {
$(".container").animate({
height: 100
});
});
also do the same for show more option:
$(document).on('click','.enlarge',function () {
//rest code
});