window.onload = function(){
var s = setInterval("sc()", 100);
}
function sc(){
var div = document.getElementById("chat_con");
div.scrollTop = div.scrollHeight;
var s = setInterval("sc()", 100);
}
function sc(){
var div = document.getElementById("chat_con");
div.scrollTop = div.scrollHeight;
}
上面只能放在最下,但无法上拉,下面是改进版
<script>
/*
$(function(){
// $(".scrollLoading").scrollLoading();
// div.scrollTop = div.scrollHeight;
$('#chat_con').scrollTop( $('#chat_con').height() );
});*/
var j=1;
var div = document.getElementById("chat_con");
var s;
window.onload = function(){
s = setInterval("sc()", 100);
}
function sc(){
j++;
div.scrollTop = div.scrollHeight;
if(j>100){
clearInterval(s);
}
//console.log(j);
}
/*
$(document).ready(function() {
$('#chat_con').scrollTop(9999999999)
});
*/
</script>