Javascript 粘性标题后如何获取响应表?

Javascript 粘性标题后如何获取响应表?,javascript,css,angularjs,sticky,Javascript,Css,Angularjs,Sticky,我已经在angular应用程序中安装了模块,我想获得一个粘性响应的thead 首字母 <!--"table" = responsive boostrap class--> <table class="table"> <thead> <tr> <th>...</th> <th>...</th> </tr>

我已经在angular应用程序中安装了模块,我想获得一个粘性响应的thead

首字母

<!--"table" = responsive boostrap class-->
<table class="table">
    <thead>
        <tr>
            <th>...</th>
            <th>...</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>...</td>
            <td>...</td>
        </tr>
    </tbody>
</table>

...
...
...
...
执行后,表格宽度固定:

    <thead>
        <tr>
            <th style="width:173px">...</th>
            <th style="width:173px">...</th>
        </tr>
    </thead>

...
...
我试图从脚本中删除style属性,但这没有帮助。我还看到该指令是响应性的

          var headersAreFixed = $q.defer();

          function fixHeaderWidths() {
            if (!$element.find("thead th .th-inner").length) {
              $element.find("thead th").wrapInner('<div class="th-inner"></div>');
            }
            if($element.find("thead th .th-inner:not(:has(.box))").length) {
              $element.find("thead th .th-inner:not(:has(.box))").wrapInner('<div class="box"></div>');
            }

            $element.find("table th .th-inner:visible").each(function (index, el) {
              el = angular.element(el);
              var width = el.parent().width(),
                lastCol = $element.find("table th:visible:last"),
                headerWidth = width;
              if (lastCol.css("text-align") !== "center") {
                var hasScrollbar = $element.find(".scrollArea").height() < $element.find("table").height();
                if (lastCol[0] == el.parent()[0] && hasScrollbar) {
                  headerWidth += $element.find(".scrollArea").width() - $element.find("tbody tr").width();
                  headerWidth = Math.max(headerWidth, width);
                }
              }
              var minWidth = _getScale(el.parent().css('min-width')),
                title = el.parent().attr("title");
              headerWidth = Math.max(minWidth, headerWidth);
              el.css("width", headerWidth);
              if (!title) {
                // ordinary column(not sortableHeader) has box child div element that contained title string.
                title = el.find(".title .ng-scope").html() || el.find(".box").html();
              }
              //el.attr("title", title.trim());
            });
            headersAreFixed.resolve();
          }
var headersarefix=$q.defer();
函数fixeheaderwidths(){
if(!$element.find(“thead th.th inner”).length){
$element.find(“thead th”).wrapInner(“”);
}
if($element.find(“thead th.th inner:not(:has(.box)))).length){
$element.find(“thead-th.th-inner:not(:has(.box))”).wrapInner(“”);
}
$element.find(“表th.th内部:可见”)。每个(函数(索引,el){
el=角元素(el);
var width=el.parent().width(),
lastCol=$element.find(“表th:visible:last”),
头部宽度=宽度;
if(lastCol.css(“文本对齐”)!=“居中”){
var hasScrollbar=$element.find(“.scrollArea”).height()<$element.find(“table”).height();
if(lastCol[0]==el.parent()[0]&&hasScrollbar){
headerWidth+=$element.find(“.scrollArea”).width()-$element.find(“tbody tr”).width();
headerWidth=数学最大值(headerWidth,width);
}
}
var minWidth=_getScale(el.parent().css('min-width')),
title=el.parent().attr(“title”);
headerWidth=数学最大值(最小宽度,headerWidth);
el.css(“宽度”,头部宽度);
如果(!标题){
//普通列(非sortableHeader)具有包含标题字符串的box子div元素。
title=el.find(“.title.ng范围”).html()| | el.find(“.box”).html();
}
//el.attr(“title”,title.trim());
});
headersAreFixed.resolve();
}

我在我的主样式表中使用css类覆盖了thwidth属性:

<table class="table-fix">
<thead>
    <tr>
        <th class="table-header-fix2">...</th>
        <th class="table-header-fix2">...</th>
    </tr>
</thead>

.table-header-fix2{
    width:12.50% !important; // 12.50 = fullScreenWidth / nr_Columns
}

在我的主样式表中,我使用css类覆盖thwidth属性:

<table class="table-fix">
<thead>
    <tr>
        <th class="table-header-fix2">...</th>
        <th class="table-header-fix2">...</th>
    </tr>
</thead>

.table-header-fix2{
    width:12.50% !important; // 12.50 = fullScreenWidth / nr_Columns
}