$("#content").append('<div>' + data.msg + '</div>'+.'<br>');
$('#content').attr({ scrollTop: $('#content').attr('scrollHeight') });
//jQuery版本1.6+时,用prop()方法代替attr()方法:
$('#content').prop({ scrollTop: $('#content').prop('scrollHeight') });
//加上动画效果
$('#content').animate({ scrollTop: $('#content').attr('scrollHeight') }, 1000);
//1.6+
$('#content').animate({ scrollTop: $('#content').prop('scrollHeight') }, 1000);
jq scrollTop
最新推荐文章于 2022-05-25 15:16:18 发布