Hi all, I'm building a page with a long scrolling story and wanted to add a sticky navigation menu to this page ONLY, to help readers with navigation.
I found a way to do it (thanks to this post by Inscape Web Design) and at first it was working beautifully, but I must have changed something by accident because now the z-index is not working, and once you scroll past the section where the code block lives, other elements on the page show up ON TOP of the sticky navigation menu (they need to be beneath/behind it to keep the navigation visible/clickable).
Here is the code I am using for the sticky navigation menu:
--
<style>
#special-nav > div{padding-right:20px}
#special-nav > div:last-child{padding-right:50px}
#special-nav {
position:fixed!important;
z-index:9999!important;
display:none;
flex-direction:row;
flex-wrap:wrap;
justify-content:flex-end;
background-color:transparent;
background-image: url("https://static1.squarespace.com/static/61e1c0b727dbad5f635ac8af/t/6398eece2768bf74e80761a2/1670966993723/organic-gradient-bg.png");
background-repeat: repeat;
background-position: center;
background-size: cover;
opacity:1.0;
padding:12px 12px 12px 12px;
width:100%;
top:64px;
left:0px;
box-shadow: 4px 4px 7px rgba(0,0,0,0.4)
}
#special-nav h3 {
color:white !important;
font-size:13px;
}
#special-nav h3 a{
color:white !important;
font-size:13px!important;
font-weight:400!important;
border-bottom-color:white !important;
}
#special-nav a:hover{color:white !important; opacity:0.6;}
@media screen and (max-width: 640px) {
#special-nav {display:none !important;}}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).on('scroll', function() {
if ($(document).scrollTop() >= 100) {
$('#special-nav').css('display', 'flex');
} else {
$('#special-nav').css('display', 'none');
}
});
</script>
<div id="special-nav">
<div><h3>2022 | Our Year in Review</h3></div>
<div><h3><a href="/2022-test#intro">Intro</a></h3></div>
<div><h3><a href="/2022-test#build-networks">Building Networks</a></h3></div>
<div><h3><a href="/2022-test#change-policies">Changing Policies</a></h3></div>
<div><h3><a href="/2022-test#shift-culture">Shifting Culture</a></h3></div>
<div><h3><a href="/2022-test#increase-capacity">Increasing Capacity</a></h3></div>
<div><h3><a href="/2022-test#nurture-org-health">Nurturing Our Organization's Health</a></h3></div>
</div>
--
I'm not a web designer or developer by any means, have only played around with html and css here and there on my own and cobbled things together. Also this is my first time posting in the forum. Would love some help figuring this out!