代码之家  ›  专栏  ›  技术社区  ›  Andres SK

添加新数据后,如何获取$(document).height()新值?

  •  0
  • Andres SK  · 技术社区  · 16 年前

    $(文档).height() 是1000。然后我在页面底部插入一个高度为100的新div $(文档).height()

    如何动态获取新的$(document).height()?

    谢谢!

    1 回复  |  直到 16 年前
        1
  •  1
  •   SteD    16 年前

    $(document).height()在这种情况下很适合我。

    如果使用变量来保存$(document).height(),请确保在执行在页面底部插入新div的操作时对其进行更新。

    <span class="click">test</span>
    

    JS公司:

    $(".click").click(function(){
    var height = $(document).height();
    console.log(height);
    for(var i=0; i< 10; i++){
    $(".click").append("<div>test</div>");}
    });