Reputation: 11374
I am using this function to update a chat conversation. The function runs every 2 seconds. When i scroll up, the update causes the page to scroll down again automaticly, which prevents me from reading old messages. How do i prevent this?
function opdaterPost(til, fra){
$('.beskeder_vis').load('calls/opdater_post.php?til=' + til + '&fra=' + fra);
$("#beskeder_vis").animate({ scrollTop: $("#beskeder_vis").prop("scrollHeight") }, 1500);
}
Upvotes: 0
Views: 211
Reputation: 5263
There are several approaches, depending on which behavior you want...
Upvotes: 1