当我想在向下滚动的同时修复一个表的thead
时,它在IE11中闪烁,但在其他人中它表现得很好。
因为它只是由位置:固定'引起的,这里只是javascript代码。
window.onload = function () {
var tableHead = document.getElementById("tableHead");
var tableBody = document.getElementById("tableBody");
var wired = document.getElementById("wired");
var divLeft = document.getElementById("divLeft");
var divTop = document.getElementById("divTop");
window.onscroll = function () {
var scrollTop = 0;
scrollTop = document.body.scrollTop;
if (scrollTop > 22) {
tableBody.style.display = "block";
tableHead.style.marginTop = "-23px";
tableHead.style.position = "fixed";
tableHead.style.zIndex = "99999";
divLeft.style.position = "";
} else {
tableHead.style.display = "block";
tableHead.style.position = "";
tableHead.style.zIndex = "0";
tableHead.style.marginTop = "0";
tableBody.style.display = "block";
}
}