Whats up code gang?
Ok I have a .sticky nav bar that contains buttons with drop-downs per button, each button has an onclick=“function()” js code. Just below the nav bar is a background slider containing images, which contains js code with a setTimeout function.
When I load the page and I DON’T scroll, the nav bar works fine and all buttons work as desired. The background slider works perfectly as well.
But if I scroll and the .sticky nav bar scrolls over the background slider my buttons on the nav bar become un-clickable UNTIIL the setTimeout function finishing running on the current picture then I am able to to click on the buttons.
Here’s my CSS code:
For my Nav Bar:
.top {
position: -webkit-sticky;
position: -moz-sticky;
position: -ms-sticky;
position: -o-sticky;
position: sticky !important;
top: -1.0px;
z-index: 2;
}
#buttons {
text-align: center;
padding-top: 1px;
padding-right: 20px;
padding-left: 20px;
padding-bottom: 5px;
color: black;
font-size: 17px;
display:inline-block;
text-decoration: none;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
z-index: 2;
}
For my slider background:
.slideshow-box {
background-color: white;
}
* {box-sizing:border-box}
/* Slideshow container */
.slideshow-container {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
object-fit: cover;
}
#onepic {
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
max-height: 600px;
}
#twopic {
background-size:cover;
background-position:center;
background-repeat:no-repeat;
max-height: 600px;
}
#threepic {
background-size:cover;
background-position:center;
background-repeat:no-repeat;
max-height: 600px;
}
/* Hide the images by default */
.mySlides {
display: none;
}
Is it my CSS code causing this issue or is my setTimeout function affecting my buttons? Thanks in advance.