【发布时间】:2017-01-19 08:03:37
【问题描述】:
我试图通过使用 position:relative 来固定在顶部位置,
$(document).ready(function() {
var container = $(".container");
container.css("overflow-y", "auto");
container.css("overflow-x", "hidden");
container.on("scroll", function() {
$("table", this).css("overflow-x", "hidden");
$("th", this).css("position", "relative");
$("th", this).css("z-index", 1);
$("th", this).css("top", this.scrollTop + "px");
});
});
问题示例https://jsfiddle.net/hth4Ly7q/2/ 它在 chrome、firefox 中运行良好,但 Safari 和 IE 在滚动时会滞后,也许有人知道如何在 safari 中修复它? 我没有使用绝对/固定位置,因为我的真实表格非常复杂,无法即时计算列宽。
【问题讨论】:
标签: javascript jquery css internet-explorer safari