gpt4 book ai didi

javascript - html表格标题与表格float_Thead不对齐

转载 作者:行者123 更新时间:2023-11-28 07:02:32 25 4
gpt4 key购买 nike

我正在使用 jquery.floatThead,当我滚动时,我的表头与我的表不对齐。当我稍微调整窗口大小时,表标题会正确对齐。这是我的 CSS:

table.floatThead-table {
border-top: none;
border-bottom: none;
background-color: gray;

}

这是我的 application.js 文件:

$(document).ready(function(){  
var $table = $('.queue-display');
$table.floatThead();

$table.trigger('reflow');

});

这是我的 jsfiddle 链接,我不确定你是否真的能看出它没有对齐:

http://jsfiddle.net/833eLyod/19/

<div style="overflow: hidden; padding-left: 0px; padding-right: 0px; position: absolute; margin-top: 0px; top: 60px; z-index: 1001; left: 0px; width: 643px;" aria-hidden="true" class="floatThead-floatContainer floatThead-container"><table class="queue-display                 table-striped                 table-hover                 table-condensed                 table-bordered                 unselectable floatThead-table" style="border-collapse: collapse; border-width: 1px 1px 0px; border-style: solid; border-color: rgb(221, 221, 221); display: table; margin: 0px; table-layout: fixed; width: 643px;"><colgroup><col style="width: 350px;"><col style="width: 72px;"><col style="width: 75px;"><col style="width: 80px;"><col style="width: 65px;"></colgroup><thead>
<tr>

<th class="queue-row-filename">
<i class="fa fa-sort" data-bind="click: function() { toggleSortBy('filename') }"></i>
filename
</th>

<!-- ko foreach: columns -->
<th data-bind="attr: {'class': 'queue-row-' + $data}" class="queue-row-sticky.note">
<!-- ko if: $parent.isSortableColumn($data) --><!-- /ko -->

<span data-bind="text: $data">sticky.note</span>
<span data-bind="if: $parent.isRemovableColumn($data)">
<i class="fa fa-close" style="cursor: pointer;" data-bind="click: $parent.removeColumn">
</i>
</span>
</th>

<th data-bind="attr: {'class': 'queue-row-' + $data}" class="queue-row-taxonomy.history">
<!-- ko if: $parent.isSortableColumn($data) --><!-- /ko -->

<span data-bind="text: $data">taxonomy.history</span>
<span data-bind="if: $parent.isRemovableColumn($data)">
<i class="fa fa-close" style="cursor: pointer;" data-bind="click: $parent.removeColumn">
</i>
</span>
</th>

<th data-bind="attr: {'class': 'queue-row-' + $data}" class="queue-row-date">
<!-- ko if: $parent.isSortableColumn($data) -->
<i class="fa fa-sort" data-bind="click: function() { $parent.toggleSortBy($data) }"></i>
<!-- /ko -->

<span data-bind="text: $data">date</span>
<span data-bind="if: $parent.isRemovableColumn($data)">
<i class="fa fa-close" style="cursor: pointer;" data-bind="click: $parent.removeColumn">
</i>
</span>
</th>

<th data-bind="attr: {'class': 'queue-row-' + $data}" class="queue-row-queue">
<!-- ko if: $parent.isSortableColumn($data) -->
<i class="fa fa-sort" data-bind="click: function() { $parent.toggleSortBy($data) }"></i>
<!-- /ko -->

<span data-bind="text: $data">queue</span>
<span data-bind="if: $parent.isRemovableColumn($data)">
<i class="fa fa-close" style="cursor: pointer;" data-bind="click: $parent.removeColumn">
</i>
</span>
</th>

<th data-bind="attr: {'class': 'queue-row-' + $data}" class="queue-row-creator">
<!-- ko if: $parent.isSortableColumn($data) -->
<i class="fa fa-sort" data-bind="click: function() { $parent.toggleSortBy($data) }"></i>
<!-- /ko -->

<span data-bind="text: $data">creator</span>
<span data-bind="if: $parent.isRemovableColumn($data)">
<i class="fa fa-close" style="cursor: pointer;" data-bind="click: $parent.removeColumn">
</i>
</span>
</th>

<th data-bind="attr: {'class': 'queue-row-' + $data}" class="queue-row-mtime">
<!-- ko if: $parent.isSortableColumn($data) --><!-- /ko -->

<span data-bind="text: $data">mtime</span>
<span data-bind="if: $parent.isRemovableColumn($data)">
<i class="fa fa-close" style="cursor: pointer;" data-bind="click: $parent.removeColumn">
</i>
</span>
</th>
<!-- /ko -->
</tr>
</thead></table></div>

这是我的 html.erb:

<!-- note that file_list.js will change this -->
<% content_for :title, 'Q' %>

<%= render 'q/queue/top_bar' %>
<div id="queue-app">


<!-- note that this requires a tabindex so it can fire key press
events -->
<table class="queue-display
table-striped
table-hover
table-condensed
table-bordered
unselectable"
tabindex="0">


<thead>
<tr>

<th class="queue-row-filename">
<i class="fa fa-sort"
data-bind="click: function() { toggleSortBy('filename') }"></i>
filename
</th>

<!-- ko foreach: columns -->
<th data-bind="attr: {'class': 'queue-row-' + $data}">
<!-- ko if: $parent.isSortableColumn($data) -->
<i class="fa fa-sort"
data-bind="click: function() { $parent.toggleSortBy($data) }"></i>
<!-- /ko -->

<span data-bind="text: $data"></span>
<span data-bind="if: $parent.isRemovableColumn($data)">
<i class="fa fa-close"
style="cursor: pointer;"
data-bind="click: $parent.removeColumn">
</i>
</span>
</th>
<!-- /ko -->
</tr>
</thead>

<tbody data-bind="foreach: {
data: visibleQueueFiles,
beforeRemove: hideQueueFileElement,
afterAdd: showQueueFileElement
}">
<tr data-bind="css: {
selectedFile: selected,
activeFile: $parent.activeQueueFile() == $data,
}, attr: {'data-queue-file' : $data.id() }">
<td>
<button type="button" class="btn btn-default btn-xs"
data-bind="click: editFile">
Edit
</button>


<a data-bind="click: function() { showInViewer() }"
class="btn btn-default btn-xs">View</a>

<span
data-bind="text: filename,
style: {
'display' : 'inline-block',
'text-decoration': moved() ? 'line-through' : ''
}
">

</span>


<span data-bind="if: moved">
Moved to <span data-bind="text: moved_to_qid"></span>
</span>

<span data-bind="if: owner">
<i class="fa fa-lock"></i>
</span>

<span data-bind="if: isNew">
<i class="fa fa-plus"
title="File added to queue"></i>
</span>


</td>

<!-- ko foreach: $parent.columns -->
<td class="qid"
data-bind="text: $parent.displayForColumn($data),
attr: { 'title' : $parent.titleForColumn($data) }">
</td>
<!-- /ko -->


</tr>
</tbody>

</table>

<script type="text/javascript">
$(document).ready(function() {
var app = new queue.App(<%= @queue_info.to_json.html_safe %>);

app.run();

window.queueApp = app;

});
</script>

<%= render 'q/queue/view_modal' %>

<copy-dialog params="queueViewModel: $root"></copy-dialog>
<rename-dialog params="queueFiles: selectedQueueFiles"></rename-dialog>
<%= render 'q/queue/custom_queues_modal' %>

<%= render 'q/queue/bottom_bar' %>


</div><!-- #queue-app -->

最佳答案

我添加了一个 select{width:100px;} floatar 已稳定 检查 http://plnkr.co/edit/1xWds0kduZCIZQXv62ka?p=preview

关于javascript - html表格标题与表格float_Thead不对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31996717/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com