replace newMessage() function to this
var docHeight = $(document).height();
function newMessage() {
message = $(".message-input input").val();
if ($.trim(message) == '') {
return false;
}
$('<li class="sent"><img src="http://emilcarlsson.se/assets/mikeross.png" alt="" /><p>' + message + '</p></li>').appendTo($('.messages ul'));
$('.message-input input').val(null);
$('.contact.active .preview').html('<span>You: </span>' + message);
$(".messages").animate({scrollTop: docHeight + 93}, "fast");
docHeight += 93;
}
adipeee (-2) - 5 years ago - Reply -2