首页 > 解决方案 > CSS使用不透明度,然后滚动表格,tbody的td覆盖了tad的th,为什么?

问题描述

我使用这个 css 将表设置为禁用。

.disabledDiv {
    pointer-events: none;
    opacity: 0.9;
}

我必须使用这种透明度。

当我滚动滚动条时,tbody 的 td 覆盖了 thead 的 th,就像这样:在此处输入图像描述

我不希望 th 被覆盖,这是我在 jsfiddle 中的代码链接

如何让th不被覆盖?

标签: javascriptjquerycss

解决方案


正如@Gerard 提到的,您有用于移动广告部分的滚动事件的 eventListener。解决方案 - 只需删除 thead 部分的 js 部分。

document.getElementById("table_reach_condition_appoint").addEventListener("scroll", function(){
           var translate = "translate(0,"+this.scrollTop+"px)";
           this.querySelector("thead").style.transform = translate;
        });

推荐阅读