Why does the hamburger menu appear below the div when I open it?

I had a vision to create a web app that would be fully functional on all devices, so I designed a navigation bar for full-screen display and a hamburger menu for smaller screens. However, I encountered a problem with my skills page. When I open the menu, it goes under the div and the rest of the links in the menu become unclickable. You can check out my app at this link:

     .nav-container {
        width: 100vw;
        height: 80px;
      }
      .Hnavbar {
        align-items: center;
        width: 100%;
        margin: 0 auto;
        overflow: hidden;
      }
    
      .navbar-logo {
        display: block;
        margin: 0;
        justify-self: start;
        float: left;
        width: 65px;
        height: 75px;
      }
    
      .nav-menu {
        margin: 0;
        width: 100%;
        position: absolute;
        top: 70px;
        left: -100%;
        opacity: 0;
        transition: all 0.5s ease;
        text-align: center;
        justify-self: end;
        background-color: red;
        height: 57vh;
        z-index: 3;
      }
      .nav-links {
        color: white;
        text-decoration: none;
        text-align: center;
        line-height: 10px;
        width: 100%;
        display: table;
      }
    
      .nav-menu.active {
        background-color: black;
        left: 0;
        opacity: 1;
        transition: all 0.5s ease;
      }
    
      #mobile-menu {
        position: absolute;
        top: 20%;
        right: 5%;
        transform: translate(5%, 20%);
        cursor: pointer;
        display: block;
      }
    
      .menu-toggle .bar {
        width: 25px;
        height: 3px;
        margin: 5px auto;
        display: block;
        transition: all 0.3s ease-in-out;
        background: white;
      }          
<div className="nav-container">
                    <nav className="Hnavbar">
                        <img className="navbar-logo" src="/yasi1.jpg"/>
                        <div className={`menu-toggle ${isactive}`}id="mobile-menu" onClick={checkClass}>
                            <span className="bar"></span>
                            <span className="bar"></span>
                            <span className="bar"></span>
                        </div>
                        <ul className={`nav-menu ${active}`}>
                            <li className="list"><a href="/" className="nav-links">Home</a></li>
                            <li className="list"><a href="/about" className="nav-links">About</a></li>
                            <li className="list"><a href="/skills" className="nav-links">Skills</a></li>
                            <li className="list"><a href="/projects" className="nav-links">Projects</a></li>
                            <li className="list"><a href="/contact" className="nav-links">Contact</a></li>
                        </ul>
                    </nav>
                </div>

https://i.sstatic.net/hed0w.jpg

Answer №1

When it comes to the navbar, there is a specific div section designed to shift your main content to the right of the navbar menu when it appears (as shown below). Additionally, there is a CSS section included to modify the style for smaller screen sizes. Take a close look at the code snippet provided.

<!DOCTYPE html>
<html>

<head>

 <!--  <meta charset="ISO-8859-1"> -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Test NavBar</title>

<style>

body {
  background-image: url('background.png');
  opacity: 0.7;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
  background-size: 100% 100%;
}


a {
  color:#a5e5f8;
}

/* Rest of the CSS styles... */

</style>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="./jsgrid/jsgrid.css" />
<link type="text/css" rel="stylesheet" href="./jsgrid/jsgrid-theme.css" />

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>

<script>

/* JavaScript functions... */

</script>

</head>

<body onload="openNav()">

<div id="mySidenav" class="sidenav"&rt;
  <!-- Navigation links and icons-->
</div>

<div id="main">
  <!-- Page content inside this div -->
</div>

<script>

function exit_app() {
    if (confirm("Exit this app?")) {
        window.location.href = "index.html";    
    }
}

</script>

</body>

</html>

Answer №2

try utilizing:

z-index:100;

for displaying the hamburger menu

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

Make a tab the active tab within the Material-UI tab component

For the current project, I have decided to utilize Material UI as the primary library. One of the pages in the project requires four tabs, which I am implementing using the tab component from the Material UI library. By default, when rendering the page wi ...

buttons for displaying a slideshow using jquery

I've been struggling with a problem for a while and I'm trying to find a solution. Here's the link to my slideshow: http://jsfiddle.net/Jtec5/33/ Here are the CSS codes: #slideshow { margin: 50px auto; position: relative; width: ...

Obtaining a complex object from a Checkbox set in AngularJS through the use of ngModel

Hey there! I've been searching on Stack Overflow regarding this topic, but I haven't found a solution that matches exactly what I need. If you want to take a look at the code, here is a JSFiddle link for reference: http://jsfiddle.net/gsLXf/1/ ...

The process of embedding variables within a JSON Array function in JavaScript

As a newcomer to JavaScript, I am facing an issue while trying to create a simple program. I am attempting to store the variables 'name', 'document', and 'code' inside the JSON array called 'records'. var records = ...

Is there a way to split each foreach value into distinct variables?

I am looking to assign different variables to foreach values. I have fetched data from an API in JSON format, and then echoed those values using a foreach loop. My goal is to display the echoed value in an input box using JavaScript. I attempted the follow ...

The JavaScript functions that are being called from an external JS file using a <script> tag are showing an error message stating they are "undefined"

UPDATE: Check out my response below as the issue has been resolved :) Just a heads up, I've only recently started diving into JavaScript and JQuery, so there might be something simple that I'm missing. Despite browsing through numerous similar q ...

Generating a dynamic triangle within a div while ensuring it fits perfectly with the maximum width

I need help with creating a responsive triangle on a web page that takes three inputs. The challenge is to adjust the size of the triangle so it fits inside a div element while maintaining the aspect ratio of the inputs. For instance, if the inputs are 500 ...

Differences between using Constructor(props) and super(props) versus simply using constructor() and super() in React Development

Although this question has been asked numerous times, it still remains unclear to me. Many have simply stated: Pass props to constructor if you want to access this.props there Here is another example of the answer The official documentation states tha ...

Social Count Total Using AddThis HTML Plugin

Our Blog uses AddThis to enable sharing of our posts. We want to track the total number of shares across all networks in one consolidated section, rather than displaying individual share counts for each network. This is the current code snippet: < ...

Building an Organized jQuery Mobile App with PhoneGap

Currently, I'm developing a game in phonegap using the jQuery Mobile framework. As my project has progressed, I've noticed that my code has turned into a tangled mess of spaghetti with one HTML file and several JavaScript classes. I'm curio ...

The items in the footer are not all aligned on a single line

Trying to create a footer with two linked images, I used justify-content: center, but it seems to be centering the images from the start rather than their actual centers. This causes them to appear slightly off to the left. Additionally, the images are sta ...

AngularJS not compatible with Angular Material

Visit this link for more details Encountering an error while using angular-material: Uncaught Error: [$injector:unpr] here's the error message$injector/unpr?p0=%24%24forceReflowProvid…eQueue%20%3C-%20%24animate%20%3C-%20%24compile%20%3C-%20%24%24an ...

Navigate to a fresh HTML page upon form submission

I'm completely new to the world of web apps and JavaScript, and I'm facing an issue where my form submission doesn't redirect me to a thank you page. Instead, it just leads to a blank page every time. I've tried researching solutions on ...

Create dynamic elements within bootstrap-vue using data from a JSON file

Currently, I am utilizing BootstrapVue (Bootstrap 4.6 and VueJS 2)! My objective is to dynamically generate elements such as input fields, dropdowns, and checkboxes based on a JSON file structured like so: [ { "unique_number": "1111", "key": ...

The example in the MUI x-data-grid documentation always seems to fall short of expectations

I followed the code from the material-ui library documentation located at this link: https://mui.com/x/react-data-grid/layout/#flex-layout My aim is to set up a flex layout on my project, I went through the steps mentioned in the documentation but keep ...

Is there logic in developing a web application using a combination of a NestJS backend and Next.js frontend, along with authentication features?

Currently, I am embarking on the journey of developing a web application using React and Next.js. With my previous experience in backend development using NestJS, I decided to integrate it into this project as well. However, I am unsure if separating the f ...

Display information on a web page based on user input using HTML

I've hidden other p tags and divs using display:none, How can I make them visible after inputting my name? I'd like to type in my name and reveal all the content within the previously hidden div <form method="post"> <p> < ...

Issues arising when serving next.js static assets from the public folder post-build

Currently, I am developing a Next.js application that needs to be deployed on an offline LAN server. The challenge I am facing is related to serving static files like images and QR codes in the backoffice section of the app where users can add, update, or ...

The occurrence of an unhandled promise rejection is triggered by the return statement within the fs

In my code, I have a simple fs.readFile function that reads data from a JSON file, retrieves one of its properties (an array), and then checks if that array contains every single element from an array generated by the user. Here is the snippet of code: co ...

Changing the fill color of an SVG pattern remains unchanged

I have been working with Vue.js to create SVGs with shape patterns as background. The patterns themselves are functioning correctly, but I am encountering an issue when attempting to dynamically change the color of the pattern filling by passing props. D ...