var height = $(document).height();
alert(height);
var heightF = height + 400;
alert(heightF);
$(document).height(heightF.toString() + "px");
alert($(document).height());第一次弹出 800 第二次弹出1200 第三次还是800 请问为什么 设置的 $(document).height(heightF.toString() + "px"); 没做用请问怎么使整个页面的高度增加400 并且滚动条向下滚动400 正好使页面显示新添加高度里的内容 谢谢大家帮忙 提前祝大家元旦快乐~~
里面加div id=xxx
你只能设置div的高度滚动距离
document.body.scrollTop=400
改成
$(document.body).height(heightF).css({margin: 0});不能直接对document对象设高度。
另外body默认的边距会影响整体高度,你可以根据情况将边距margin设为0;