0
我有一个自动滚动到底部的div。但是,每当在一个聊天帖子中使用很多笑脸,自动滚动停止正常工作,它从底部滚动2行。DIV自动滚动不起作用
我也尝试使用这个..
$("#chatbox").animate({ scrollTop: newscrollHeight }, 'normal');
但DIV自动加载每3秒,所以每次它加载动画效果将显现。
我可以在什么地方使用以确保其正常工作?
这里是全功能...
setInterval(function loadLog(){
var oldscrollHeight = $("#chatbox").prop("scrollHeight") - 20;
$.ajax({
url: "log.php",
cache: false,
success: function(html){
$("#chatbox").html(html); //Insert chat log into the #chatbox div
var newscrollHeight = $("#chatbox").prop("scrollHeight") - 20; //Scroll height after the request
$("#chatbox").animate({ scrollTop: newscrollHeight }, 'normal'); //Autoscroll to bottom of div
},
});
}, 3500);