【发布时间】:2019-04-13 01:02:38
【问题描述】:
当单击tr.clickable 时,我试图折叠其中包含一个表格的tr.store-id 行。
你可以看到我当前的问题presented in this jsfiddle,表格似乎在出现后自我调整以适应列title1!。我希望可折叠表格适合整行而不是一列。
我尝试将.collapse 的display 属性更改为table-row 等值,但没有成功。谁能告诉我是什么问题?
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<style>
tr.collapse.in {
display: table-row;
}
</style>
</head>
<body>
<div class="container">
<table class="table table-bordered">
<thead>
<tr>
<th scope="col">title1</th>
<th scope="col">title2</th>
<th scope="col">title3</th>
</tr>
</thead>
<tbody>
<tr data-toggle="collapse" data-target=".store-id" class="clickable">
<td>hi there</td>
<td>hi there</td>
<td>hi there</td>
</tr>
<tr class="collapse store-id">
<td colspan="3">
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Handle</th>
<th scope="col">Handle</th>
</tr>
</thead>
<tbody>
<tr>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
<td>@mdo</td>
<td>@mdo</td>
</tr>
<tr>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
<td>@fat</td>
<td>@fat</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
【问题讨论】:
-
寻求调试帮助的问题(“为什么这段代码不起作用?”)必须在问题本身中包含所需的行为、特定问题或错误以及重现它所需的最短代码 。 stackoverflow.com/help/on-topic 不接受指向第三方网站的链接。
-
@Rob,我希望可折叠的表格适合整行而不是一列