【问题标题】:how to get exact decimal height for table rows using jquery如何使用jquery获取表格行的精确小数高度
【发布时间】:2018-07-03 01:00:48
【问题描述】:

它给出整数值。

如果值为 15.6,则显示 16 OR 如果值为 15.2,则显示 15

怎么做?请帮忙

【问题讨论】:

标签: javascript jquery jquery-ui frontend web-frontend


【解决方案1】:

您可以尝试使用下面的方法来获取高度

function getHeight(id){
    var bound = $("#"+id)[0].getBoundingClientRect();
    var height;
    if (bound.height) {
      height = bound.height;
    } else {
      height = bound.top - bound.bottom;
    }
    return height;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-01-02
    • 1970-01-01
    • 2011-05-13
    • 1970-01-01
    • 2014-05-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多