动态查找高度 [英] Finding Height dynamically

查看:54
本文介绍了动态查找高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  • DIV中的所有DIV标签和列表项都是使用ng-repeat(Angular JS)动态构建的
  • 我们使用以下代码来修复iframe高度,这样做非常好。但我们在获取某些标签的高度方面遇到了一些问题(即身体部位高度)
  • 获得的值不一致(范围从40px至800px但实际高度为450px)
  • adjustSize: function ( ){

     

            var
    contentHeight = jQuery(
    '#announcementSwatchId' )。height();
    - 我们无法为此DIV TAG获得一致的价值

           var contentHeight = jQuery('#announcementSwatchId').height(); - WE ARE UNABLE TO GET A CONSISTENT VALUE FOR THIS DIV TAG

       

      resizeMessage =
    '< message senderId = {Sender_ID}>调整大小({宽度},{高度})< / message>' ;

            resizeMessage = resizeMessage.replace( " {Sender_ID}"
    this 。senderId);

          

      resizeMessage = resizeMessage.replace( " {高度}"
    contentHeight);

          

      resizeMessage = resizeMessage.replace( " {Width}"
    " 100%" );

            window.parent.postMessage(resizeMessage,
    " *" );

       },

    推荐答案

    嗨Narender,

    Hi Narender,

    据我所知,如果列表项是在div标签内使用Angular JS动态构建的,那么div的高度也将是动态的。

    As I understand, if the list items is built dynamically using Angular JS within a div tag, then the height of the div will also be dynamical.

    我建议您可以创建另一个具有更高高度的div来打包动态div,这样我们就可以获得固定值而不是动态值。

    I suggest you can create another div with more height to package the dynamical div so that we can get the fixed value instead of the dynamical one.

    嵌套DIV和CSS浮动教程

    谢谢

    最好的问候


    这篇关于动态查找高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆