The collapsing z-index menu in Bootstrap 4 is experiencing CSS issues and is not functioning correctly

I have a bootstrap 4 menu with a slide effect that is functioning correctly, but there seems to be an issue with the z-index value I have set for it. Specifically, there is some content within a parallax jumbotron that is overlapping the menu links. I need a CSS solution to resolve this problem, as this is the first time I have encountered it. Below is the code I am using, including the parallax jumbotron and menu-related code. I suspect that the code responsible for applying an overlay effect on the background image underneath the content is causing the problem.

CSS:

.st-parallax{
  height: 100vh;
  width: 100%;
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}
.parallax{
  filter: grayscale(100);
}
.parallax__container{
  z-index: 1;
}
.parallax-icon, .parallax-heading, .parallax-text {
  color: white;
}
.parallax-content {
  margin: 12em 0 4em 0;
  z-index: 2;
}
.overlay{
  height: inherit;
  position: absolute;
  background: rgba(0,0,0,0.5);
  width: 100%;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1;
}
#bs-nav {
    transition: all 300ms;
    z-index: 2;
    background-color: white;
}
#navbar-content {
    height: 100vh;
    top: 0
}
.navbar-collapse {
    position: absolute;
    left: 0;
    padding-left: 15px;
    padding-right: 15px;
    padding-bottom: 15px;
    width: 35%;
    background-color: white;
}
.navbar-collapse.collapsing {
    -webkit-transition: left .3s ease;
    -o-transition: left .3s ease;
    -moz-transition: left .3s ease;
    transition: left .3s ease;
    left: -100%
}
.navbar-collapse.show {
    left: 0;
    -webkit-transition: left .3s ease-in;
    -o-transition: left .3s ease-in;
    -moz-transition: left .3s ease-in;
    transition: left .3s ease-in
}

PARALLAX HTML:

<div class="jumbotron jumbotron-fluid st-parallax">
  <div class="parallax" data-parallax-image="<?php bloginfo('template_url') ?>/assets/img/staff-heading.jpg" data-bg="url(<?php bloginfo('template_url') ?>/assets/img/staff-heading.jpg)"></div>
  <div class="container">
    <div class="row">
      <div class="col-sm-12 col-md-12 col-lg-12 parallax-content">
        <h4 class="parallax-icon hide"><i class="far fa-address-card"></i></h4>
        <h1 class="parallax-heading hide"><?php _e('staff'); ?></h1>
        <p class="lead parallax-text hide"><?php _e('lorem ipsum.'); ?></p>
      </div>
    </div>
  </div>
  <div class="overlay"></div>
</div>

MENU HTML

<!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="profile" href="http://gmpg.org/xfn/11">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>

  <div class="preloader text-center">
    <img class="img-fluid" src="<?php bloginfo('template_url')?>/assets/img/logo-black.jpg" width="300" id="preloader-img" />
  </div>

  <nav class="navbar fixed-top shadow-lg" id="bs-nav">
    <div class="container-fluid" style="z-index:4;">

      <div class="navbar-header">
        <a class="navbar-brand" href="<?php bloginfo('url'); ?>">
          <img src="<?php bloginfo('template_url'); ?>/assets/img/logo-black.jpg" id="" width="80" height="80">
        </a>
      </div>

      <div class="row">
        <div class="col-sm-12 col-md-12 col-lg-12 float-right">
          <button class="hamburger hamburger--spin" type="button" data-toggle="collapse" data-target="#navbar-content" aria-controls="navbar-content" aria-expand="false" aria-label="<?php _e('Toggle Navigation'); ?>">
            <span class="hamburger-box">
            <span class="hamburger-inner"></span>
            </span>
          </button>
        </div>
      </div>
    </div>

      <div class="collapse navbar-collapse" id="navbar-content">
        <div class="container">
          <div class="row">
            <div class="col-sm-12 col-md-12 col-lg-12">
              <?php
                wp_nav_menu( array(
                    'theme_location' => 'header-menu',
                    'menu'        => 'Menu',
                    'container'      => false,
                    'depth'          => 2,
                    'menu_class'     => 'navbar-nav ml-auto',
                    'walker'         => new Bootstrap_NavWalker(),
                    'fallback_cb'    => 'Bootstrap_NavWalker::fallback',
                ) );
              ?>
            </div>
          </div>
        </div>
      </div>
  </nav>

Here is a screenshot of the issue: [Link to screenshot](https://i.sstatic.net/TzCo0.jpg)

Answer №1

After some troubleshooting, I was able to find the solution to my problem. It turns out I had mistakenly assigned the z-index to the wrong container, causing the parallax background image not to display correctly. I made the necessary adjustment by assigning the z-index value to the jumbotron parallax container, and now everything is working perfectly.

.st-parallax{
  height: 100vh;
  width: 100%;
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

"Communication + AngularJS + Social Networking - The Perfect Trio

I'm currently in the process of developing an Angular app that will eventually be compiled using PhoneGap for both Android and iOS platforms. While testing various plugins to incorporate Facebook integration (specifically for login and sharing), I enc ...

Can 2D canvas elements make use of CSS shaders?

Can CSS shaders, like "fragment" shaders, be utilized in 2D canvas contexts as well? ...

Exploring the Potential of CSS Styling within Vue.js

I am in the process of creating a website and I am looking for a way to manage my styles through Vue. I want to be able to utilize CSS with Vue, as the style of .skill-bar serves as the background of the bar, while .skill-bar-fill represents the green fil ...

Having issues with the tailwindcss transformation not functioning properly, but the problem seems to resolve when directly incorporating it into the

Lately, I decided to start utilizing tailwindcss and I have noticed that certain properties do not seem to function at all. However, when I incorporate them into my CSS directly, they work perfectly fine. Allow me to provide an example. const Step = styled ...

Store the checkbox's data in the database for safekeeping

Hey there, I'm working on saving the value of a checkbox using PHP. The twist is that the value is generated through JavaScript. How can I handle this scenario and save the value using PHP? Checkbox: <input type='checkbox' name='ca ...

How do you set a background image for the color of the font?

Imagine I have this piece of code: <span>Hello world!</span> Along with the following CSS: span{ color:red; } Is it possible to replace the red value with an image? Something like url(images/text-bg.png);? I am looking to add a texture to m ...

What could be causing the slight pause in my CSS3 animation at each keyframe percentage range?

I'm currently working on an animation for a sailing ship, but I'm encountering some issues with its smoothness. Whenever I make changes in the @keyframes, the animation stops abruptly. The movement involves using transform:rotate(-5deg) and then ...

CSS: Breaking free from the constraints of a Bootstrap-inspired grid layout

Looking to create a template with a background on the left side that extends to the edge of the page within an 8 of 12 bootstrap columns setup. The remaining 4 columns on the right will not have a background. This layout should be responsive, stacking on t ...

The display function in Javascript has a tendency to work sporadically

I’ve been tasked with creating my own tic tac toe game through coding. While I am relatively new to programming, I have a strong passion for it. At the moment, I've set up a basic function to hide only the "O", leaving only the "X" visible on the gr ...

Unable to decipher Material UI class names

I am experimenting with a React app using Material UI to explore different features. I'm attempting to customize the components following the original documentation, but making some changes as I am using classes instead of hooks. However, I keep encou ...

Utilizing Bootstrap for aligning a span element beneath a div container

I'm working on enhancing a project by integrating more Bootstrap elements. In one part, I have a circular div with the text "Go to Homepage" below it. My goal is to center the span under the div and have it appear on a single line. How can I achieve t ...

Utilize multiple classes in inline styling within HTML

I'm trying to dynamically apply the "more" CSS class directly to an inline style tag, but I haven't had success with my current approach. Unfortunately, in my situation, I can't create a class. The method is working for <p> tags but no ...

Tips for Personalizing Bootstrap 4.3 Through BootstrapCDN

I'm having trouble customizing the Bootstrap 4.3 BootstrapCDN by linking an external CSS file to override it. Even though I have placed the custom CSS file below the Bootstrap one, it doesn't seem to be taking effect. Can anyone explain why? Th ...

Tips for efficiently removing a user as an administrator

Whenever a user logs in or registers, I save their session and cookie information and also add certain details to the database. Login/Register Module (login/register.php) $_SESSION['userid'] = $userid; $selector = base64_encode(random_bytes(9)) ...

Varying spacing among elements with identical classes

I'm facing some styling issues. My goal is to ensure that each h3 tag has the same distance between the bottom border of its container (marked with a pink border) and the bottom border of its parent (indicated in the image below): https://i.sstatic.ne ...

What is the best way to align an element based on the position of another element?

I have integrated a calendar icon above a fullcalendar, and when I click on the icon, a react-datepicker pops up. Here is my CSS : .react-datepicker { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 0.8rem; background-color: ...

What is the reason for hasChildNodes returning true when dealing with an Empty Node?

When the user clicks on purchase and the cart is empty, there should be an alert. However, it seems that no response is triggered. Upon running the program, an error message appears stating that it cannot read the property of addEventListener which is unde ...

Display intricate header and preview in a printed datatable

Hey there, I've been using the Datatable plugin and it's really great. However, I've come across a problem with complex headers like this: <thead> <tr><td>some text</td></tr> <tr><td>some te ...

When attempting to print a Rectangle on my webpage using JavaScript and taking user input, I encountered an error stating that 'str' is not defined

I'm trying to implement a feature where clicking on the "try it" button will prompt the user for the number of lines and then print that many lines in the form of a rectangle. However, when I run my code, nothing appears on the DOM and there is an err ...

Retrieving addresses by extracting p from the Python class within a div

Currently the code: Extracts URLs for various gyms and saves them in a CSV file as shown below: https://www.lifetime.life/life-time-locations/al-vestavia-hills.html https://www.lifetime.life/life-time-locations/az-biltmore.html Desired functionality: I&a ...