由於其他提供的解決方案(也是我想避免jQuery這樣的解決方案:stackoverflow)對這個主題不起作用,我打開了一個新問題。我怎樣才能使表頭固定在垂直滾動?引導固定在滾動上的嵌套表頭
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class=container>
<div class=row>
<div class=col-sm-12>
<div class="table-responsive">
<table class="table table-condensed table-bordered table-hover fixed_headers">
<thead>
<tr>
<th rowspan="2" style="width: 10px"><span class="text-muted">#</span></th>
<th rowspan="2">ID</th>
<th rowspan="2">Name</th>
<th colspan="4">r 1</th>
<th colspan="4">r 2</th>
<th rowspan="2" ng-click="sortTableBy('recognized')" class="change-sort-order">ERK
</th>
<th rowspan="2">ERW
</th>
<th rowspan="2"><span class="text-muted">Radar</span></th>
<th rowspan="2"><span class="text-muted">RISS</span></th>
</tr>
<tr>
<th>
A 1
</th>
<th>
A 2
</th>
<th>
A 3
</th>
<th>
A 4
</th>
<th>
A 1
</th>
<th>
A 2
</th>
<th>
A 3
</th>
<th>
A 4
</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="text-muted">1</span></td>
<td>ididid</td>
<td>name</td>
<td>
aaa
</td>
<td>
bbb
</td>
<td>
ccc
</td>
<td>
ddd
</td>
<td>
ee </td>
<td>
ffubfhiuwefuh
</td>
<td>
dd
</td>
<td>
gg </td>
<td>gg
</td>
<td ng-class="{'success': x.expected, 'danger':!x.expected}" class="success text-center">
</td>
<td>
<button type="button" class="btn btn-default btn-xs center-block">Show
</button>
</td>
<td>
</td>
</tr>
<tr>
<td><span class="text-muted">1</span></td>
<td>ididid</td>
<td>name</td>
<td>
aaa
</td>
<td>
bbb
</td>
<td>
ccc
</td>
<td>
ddd
</td>
<td>
ee </td>
<td>
ff
</td>
<td>
dd
</td>
<td>
gg </td>
<td>gg
</td>
<td ng-class="{'success': x.expected, 'danger':!x.expected}" class="success text-center">
</td>
<td>
<button type="button" class="btn btn-default btn-xs center-block">Show
</button>
</td>
<td>
</td>
</tr>
<tr>
<td><span class="text-muted">1</span></td>
<td>ididid</td>
<td>name</td>
<td>
aaa
</td>
<td>
bbb
</td>
<td>
ccc
</td>
<td>
ddd
</td>
<td>
ee </td>
<td>
ff
</td>
<td>
dd
</td>
<td>
gg </td>
<td>gg
</td>
<td ng-class="{'success': x.expected, 'danger':!x.expected}" class="success text-center">
</td>
<td>
<button type="button" class="btn btn-default btn-xs center-block">Show
</button>
</td>
<td>
</td>
</tr>
<tr>
<td><span class="text-muted">1</span></td>
<td>ididid</td>
<td>name</td>
<td>
aaa
</td>
<td>
bbbjiodeijoew
</td>
<td>
ccc
</td>
<td>
ddd
</td>
<td>
ee </td>
<td>
ff
</td>
<td>
dd
</td>
<td>
gg </td>
<td>gg
</td>
<td ng-class="{'success': x.expected, 'danger':!x.expected}" class="success text-center">
</td>
<td>
<button type="button" class="btn btn-default btn-xs center-block">Show
</button>
</td>
<td>
</td>
</tr>
<tr>
<td><span class="text-muted">1</span></td>
<td>ididid</td>
<td>name</td>
<td>
aaa
</td>
<td>
bbb
</td>
<td>
ccc
</td>
<td>
ddd
</td>
<td>
ee </td>
<td>
ff
</td>
<td>
dd
</td>
<td>
gg </td>
<td>gg
</td>
<td ng-class="{'success': x.expected, 'danger':!x.expected}" class="success text-center">
</td>
<td>
<button type="button" class="btn btn-default btn-xs center-block">Show
</button>
</td>
<td>
</td>
</tr>
<tr>
<td><span class="text-muted">1</span></td>
<td>ididid</td>
<td>name</td>
<td>
aaa
</td>
<td>
bbb
</td>
<td>
ccc
</td>
<td>
ddd
</td>
<td>
ee </td>
<td>
ff
</td>
<td>
dd
</td>
<td>
gg </td>
<td>gg
</td>
<td ng-class="{'success': x.expected, 'danger':!x.expected}" class="success text-center">
</td>
<td>
<button type="button" class="btn btn-default btn-xs center-block">Show
</button>
</td>
<td>
</td>
</tr>
<tr>
<td><span class="text-muted">1</span></td>
<td>ididid</td>
<td>name</td>
<td>
aaa
</td>
<td>
bbb
</td>
<td>
ccc
</td>
<td>
ddd
</td>
<td>
ee </td>
<td>
ff
</td>
<td>
dd
</td>
<td>
gg </td>
<td>gg
</td>
<td ng-class="{'success': x.expected, 'danger':!x.expected}" class="success text-center">
</td>
<td>
<button type="button" class="btn btn-default btn-xs center-block">Show
</button>
</td>
<td>
</td>
</tr>
<tr>
<td><span class="text-muted">1</span></td>
<td>ididid</td>
<td>name</td>
<td>
aaa
</td>
<td>
bbb
</td>
<td>
ccc
</td>
<td>
ddd
</td>
<td>
ee </td>
<td>
ff
</td>
<td>
dd
</td>
<td>
gg </td>
<td>gg
</td>
<td ng-class="{'success': x.expected, 'danger':!x.expected}" class="success text-center">
</td>
<td>
<button type="button" class="btn btn-default btn-xs center-block">Show
</button>
</td>
<td>
</td>
</tr>
<tr>
<td><span class="text-muted">1</span></td>
<td>ididid</td>
<td>name</td>
<td>
aaa
</td>
<td>
bbb
</td>
<td>
ccc
</td>
<td>
ddd
</td>
<td>
ee </td>
<td>
ff
</td>
<td>
dd
</td>
<td>
gg </td>
<td>gg
</td>
<td ng-class="{'success': x.expected, 'danger':!x.expected}" class="success text-center">
</td>
<td>
<button type="button" class="btn btn-default btn-xs center-block">Show
</button>
</td>
<td>
</td>
</tr>
<tr>
<td><span class="text-muted">1</span></td>
<td>ididid</td>
<td>name</td>
<td>
aaa
</td>
<td>
bbb
</td>
<td>
ccc
</td>
<td>
ddd
</td>
<td>
ee </td>
<td>
ff
</td>
<td>
dd
</td>
<td>
gg </td>
<td>gg
</td>
<td ng-class="{'success': x.expected, 'danger':!x.expected}" class="success text-center">
</td>
<td>
<button type="button" class="btn btn-default btn-xs center-block">Show
</button>
</td>
<td>
</td>
</tr>
<tr>
<td><span class="text-muted">1</span></td>
<td>ididid</td>
<td>name</td>
<td>
aaa
</td>
<td>
bbb
</td>
<td>
ccc
</td>
<td>
ddd
</td>
<td>
ee </td>
<td>
ff
</td>
<td>
dd
</td>
<td>
gg </td>
<td>gg
</td>
<td ng-class="{'success': x.expected, 'danger':!x.expected}" class="success text-center">
</td>
<td>
<button type="button" class="btn btn-default btn-xs center-block">Show
</button>
</td>
<td>
</td>
</tr>
<tr>
<td><span class="text-muted">1</span></td>
<td>ididid</td>
<td>name</td>
<td>
aaa
</td>
<td>
bbb
</td>
<td>
ccc
</td>
<td>
ddd
</td>
<td>
ee </td>
<td>
ff
</td>
<td>
dd
</td>
<td>
gg </td>
<td>gg
</td>
<td ng-class="{'success': x.expected, 'danger':!x.expected}" class="success text-center">
</td>
<td>
<button type="button" class="btn btn-default btn-xs center-block">Show
</button>
</td>
<td>
</td>
</tr>
<tr>
<td><span class="text-muted">1</span></td>
<td>ididid</td>
<td>name</td>
<td>
aaa
</td>
<td>
bbb
</td>
<td>
ccc
</td>
<td>
ddd
</td>
<td>
ee </td>
<td>
ff
</td>
<td>
dd
</td>
<td>
gg </td>
<td>gg
</td>
<td ng-class="{'success': x.expected, 'danger':!x.expected}" class="success text-center">
</td>
<td>
<button type="button" class="btn btn-default btn-xs center-block">Show
</button>
</td>
<td>
</td>
</tr>
<tr>
<td><span class="text-muted">100</span></td>
<td>ididid</td>
<td>name</td>
<td>
aaa
</td>
<td>
bbb
</td>
<td>
ccc
</td>
<td>
ddd
</td>
<td>
ee </td>
<td>
ff
</td>
<td>
dd
</td>
<td>
gg </td>
<td>gg
</td>
<td ng-class="{'success': x.expected, 'danger':!x.expected}" class="success text-center">
</td>
<td>
<button type="button" class="btn btn-default btn-xs center-block">Show
</button>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
這並不連同水平滾動 – d4rty
@ d4rty Iknow工作,因爲我已經告訴。您必須調整'CSS'才能創建更好的視圖,並且不可能使水平滾動成爲可能。你只需要尋找一個'CSS'的解決方案。所以這就是爲什麼我給了這個答案 – Deathstorm