0
最好用現場示例描述。 我花了幾個小時嘗試寬度規格的各種組合 - 與px,% - 試圖停止列的寬度取決於它是否應用了符號圖形文字鉛筆類 。如果您不將鼠標放在桌子上,則與將鼠標放在桌子上的情況相比,它的寬度更窄。製作切換元素包含表格停止更改列寬
$(function() {
$(document).on('mouseover', '#tasks_for_myself_table tbody tr', function(e) {
set_task_editor_icon_visibility($(this))
});
$(document).on('mouseout', '#tasks_for_myself_table tbody tr', function(e) {
set_task_editor_icon_visibility($(this))
});
});
var set_task_editor_icon_visibility = function($row) {
$row.find('td.task_editing').toggleClass('glyphicon glyphicon-pencil');
}
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class = 'container'>
<div class = 'row'>
<div class = 'col-sm-9'>
<table id="tasks_for_myself_table" class="table table-hover table-condensed draggable">
<thead>
<th></th>
<th></th>
</thead>
<tbody>
<!-- If there are any initiated tasks at all -->
<tr>
<td style = 'width: 2em' class='task_editing'></td>
<td>AAAAA</td>
<td>BBBBBBB</td>
</tr>
<tr>
<td style = 'width: 2em' class='task_editing'></td>
<td>AAAAA</td>
<td>BBBBBBBB</td>
</tr>
</tbody>
</table>
</div>
<div class = 'col-sm-3'>I love this site</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script>
請使用堆棧片段可運行演示。 –