我的英雄部分下面有一个标题,用js将固定方法添加到position属性。当位置设置为固定时,标题消失。效果可以在这里看到:
http://redesign.hfe-observatories.org/about/
我尝试过以下解决方案:
Header disappearing when position is fixed
但标题仍然消失。
<section class="intro"></section>
<div class="sticky-wrap">
<header id="header"></header>
</div>
<section id="aim" class="features section-padding"></section>
.intro {
position: relative;
z-index: 1;
padding: 0;
height: 98%;
width: 100%;
background: url(img/placeholder.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
#header {
width: 100%;
position: relative;
border-bottom: 1px solid #E6E9EA;
}
#header.stuck {
position: fixed;
top: 0;
background: #fff;
z-index: 999;
}