我对这段代码有疑问:
setInterval(function() {
var timed = $("#chMsgCont").find(".chatMsg:last-child");
var timee = timed.attr("data");
$.ajax({
url: "./ajax/checknew.php",
data: {timestamp: timee},
success: function(data) {
$("#chMsgCont").append(data);
if(data != null) {
var div = $('#chMsgCont');
var o = div.offset().top;
div.scrollTop( o + 12302012 );
}
}
});
},1000);
即使数据为空,$("#chMsgCont)
向下滚动,为什么?