我想在加载div时允许自动滚动到底部,然后禁用该功能我怎么可能这样做
//$("#chatroom").animate({ scrollTop: $(document).height() }, "slow");
var scrolled = 0;
$("#chatroom").animate({
scrollTop: $('#chatroom')[0].scrollHeight
}, 1000)
scrolled = 1;
$('#closechat').live('click', function () {
$('#chatroom').hide();
stoprefresh();
});
答案 0 :(得分:1)
检查出来...... http://jsfiddle.net/reWwx/227/
您可以根据需要更改底部值。
$(document).ready(function(){
var bodyHeight = $('body').height();
var footerOffsetTop = $('#line-three').offset().top;
var topToBottom = bodyHeight -footerOffsetTop;
$('#line-three').css({top:'auto',bottom:topToBottom});
$("#line-three").delay(100).animate({
bottom: '50px',
}, 1200, function() {
$('#line-three').hide(500);
});
})