我为我的 html 表格
设计了一个固定的标题。现在,当我向下滚动页面时,除一个 slider(noUiSlider)
外,所有内容都被固定标题重叠。我想知道 css
的哪个属性不允许 header 覆盖此 slider 。
固定标题的CSS:
#header-fixed {
position: fixed;
top: 0px; display:none;
background-color:white;
}
固定标题的 JS:
var tableOffset = $("#listView-tab").offset().top;
//var $header = $("#listView-tab > thead").clone();
var $fixedHeader = $( "#header-fixed" );
$(window).bind("scroll", function() {
var offset = $(this).scrollTop();
if (offset >= tableOffset && $fixedHeader.is(":hidden")) {
$fixedHeader.show();
}
else if (offset < tableOffset) {
$fixedHeader.hide();
}
});
在附加屏幕中,第一个图像显示了与 slider 关联的所有元素。 在第二个屏幕中,除了 slider 之外,所有其他元素都会重叠。
最佳答案
你想看到重叠的元素必须有:
z-index: 0
应该位于顶部的元素必须具有:
z-index:1
或更高。
关于javascript - CSS 的哪个属性不允许固定标题覆盖滚动元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37965513/