The mobile screen menu is causing me some issues

I've written this code snippet (below) that generates a hamburger icon on mobile devices. When the user clicks it, a wave effect appears and covers everything on the screen, but I'm facing an issue where the wave can't cover the Brand section.

My query is how can I make the Brand disappear under the wave?

Alternatively,

How can I ensure that the space below the Brand and the hamburger icon also disappears under the wave effect?

Here's the link to my code: https://codepen.io/Sinano/pen/MWyprpM

const hamburger = document.querySelector(".hamburger");
const navLinks = document.querySelector(".nav-links");
const links = document.querySelectorAll(".nav-links li");

hamburger.addEventListener("click", () => {
  navLinks.classList.toggle("open");
  links.forEach(link => {
    link.classList.toggle("fade");
  });
});
* {
  margin: 0;
  padding: 0;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

#nav-bar {
  display: flex;
  justify-content: space-between;
  height: 9vh;
  background: #dfdb14!important;
  padding-top: 1rem;
}

#brand {
  padding-top: 0.5rem;
  padding-left: 4rem;
}

.nav-links {
  display: flex;
  list-style: none;
  width: 40%;
  height: 100%;
  justify-content: space-around;
  align-items: center;
  margin-left: auto;
  margin-right: 2rem;
}

.items {
  color: white;
  text-decoration: none;
  font-size: 16px;
  font-family: 'Roboto', sans-serif;
}

@media screen and (max-width: 768px) {
  .line {
    width: 30px;
    height: 3px;
    background: white;
    margin: 5px;
  }
  #brand {
    padding-top: 0.5rem;
    padding-left: 0;
  }
  #nav-bar {
    position: relative;
    padding-top: 0;
  }
  .hamburger {
    position: absolute;
    cursor: pointer;
    right: 5%;
    top: 50%;
    transform: translate(-5%, -50%);
    z-index: 2;
  }
  .nav-links {
    background: #5b78c7;
    height: 94.8vh;
    width: 100%;
    margin-right: 0;
    flex-direction: column;
    clip-path: circle(100px at 100% -18%);
    -webkit-clip-path: circle(100px at 100% -18%);
    transition: all 2s ease-out;
    pointer-events: none;
  }
  .nav-links.open {
    clip-path: circle(1000px at 90% -10%);
    -webkit-clip-path: circle(1000px at 90% -10%);
    pointer-events: all;
  }
  .menu {
    opacity: 0;
  }
  .items {
    font-size: 20px;
  }
  .menu:nth-child(1) {
    transition: all 0.5s ease 0.2s;
  }
  .menu:nth-child(2) {
    transition: all 0.5s ease 0.4s;
  }
  .menu:nth-child(3) {
    transition: all 0.5s ease 0.6s;
  }
  .menu:nth-child(4) {
    transition: all 0.5s ease 0.8s;
  }
  .menu:nth-child(5) {
    transition: all 0.5s ease 1s;
  }
  .menu.fade {
    opacity: 1;
  }
}

.s1 {
  height: 90vh;
  width: 100%;
  background: white!important;
  overflow: hidden;
}
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
  <link rel=”stylesheet” href=”css/bootstrap-responsive.css”>
  <link rel="stylesheet" href="css.css">
  <link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
</head>

<body>

  <nav id="nav-bar">
    <div class="hamburger">
      <div class="line"></div>
      <div class="line"></div>
      <div class="line"></div>
    </div>
    <h3 id="brand">BRAND</h3>
    <ul class="nav-links">
      <li class="menu"><a class="items" href="#">Home</a></li>
      <li class="menu"><a class="items" href="#">Publisher Rates</a></li>
      <li class="menu"><a class="items" href="#">Create Account</a></li>
      <li class="menu"><a class="items" href="#">Login</a></li>
    </ul>
  </nav>
  <section class="s1">


  </section>
</body>

Answer №1

If you want to make the navigation links appear above the brand text, try adding this CSS code:

@media screen and (max-width: 768px){
.nav-links{
    position: absolute;
}

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

CSS based on Media Query width is not being applied after content has been rewritten by an AJAX call

Check out this website (created using Zurb Foundation Framework) where, on screens wider than 425px, there is a row of books displayed on a background image resembling a bookshelf within a specific div element. However, when viewing the page on a phone o ...

Update the color of the header background in an HTML table to match its original shade

Whenever a selection is made from the dropdown menu, a script triggers to change the background color of the selected number in the table header. I'm trying to figure out how to revert the background color back to its original state after making a ne ...

Scrollbar malfunction in Angular and Bootstrap主 The main scrollbar in Angular and Bootstrap is un

I am currently facing an issue with my Angular app using Bootstrap 5. The main html/body scrollbar does not work when elements overflow the view. I have tried various solutions such as setting a fixed height, adjusting overflow-y to scroll or auto for body ...

Comparing elements in one array to elements in another array

In AngularJS, the $scope.categories array is populated from a multi-select element. $scope.categories = ["Adventure", "Strategy"] To compare this array with the categories in the items array below: $scope.items = [ { title: "Star Wars", ...

How to Send Data to ASP.NET MVC Controller Using AJAX Request with jQuery

I am trying to send parameters to a controller from jQuery, but I am struggling with it. The call works fine without parameters when the URL is just /SurveySection/EditLocalization. Shouldn't it be something like this: /SurveySection/EditLocalization? ...

Arrange documents within gulp-inject index function

I have encountered an Angular error due to the sorting of my files, so I am attempting to organize them properly. This is the content of my Gulp file: var gulp = require('gulp'); var angularFilesort = require('gulp-angular-filesort'); ...

The default values for CSS filters

I have a keen interest in various CSS filters: blur brightness contrast grayscale hue-rotate invert opacity saturate sepia Could someone provide the default values for each filter (preferably as a % value, where applicable)? The MDN documentation does no ...

Error occurs when React-router 6 cannot render an error component

I'm facing an issue in my React app where the custom error component I created for unmatched routes is not being rendered, instead the default error page appears. Here's a snippet of how my BrowserRouter is set up: const router = createBrowserRo ...

How can I trigger a page postback in ASP.NET after downloading a file?

Here is my current scenario: The user clicks on a LinkButton, triggering a PostBack on the page. However, I also need to initiate a file download for the user simultaneously. To achieve this, I added the following code to the LinkButton: lnkPrint.Attri ...

Utilizing JavaScript regex to eliminate multiple backslashes while maintaining the special character

To load JSON data with multiple backslashes before a newline character, we are utilizing JavaScript. An example of this is: { "test": { "title": "line 1\\\\\\\nline2" } } Various RegEx patterns have been ...

Leverage the power of the React useFetch hook with an onclick/event

My component utilizes a custom reusable hook for making HTTP calls. Here is how I am using it: const { data, error, isLoading, executeFetch } = useHttp<IArticle[]>('news', []); Additionally, within the same component, there is a toggle che ...

Trigger JavaScript function once all Ajax requests have completed

Seeking assistance with troubleshooting JavaScript code that is not functioning as expected. The Application sends file names to the server via Ajax calls for processing, but I need to update the database once all imports are complete. The problem arises ...

Utilizing a backup system to store environment variables within a configuration file

Currently, I am utilizing my environment variables by directly referencing process.env.NODE_ENV throughout my application. While this method works, it is becoming challenging to manage and keep track of. Therefore, I would like to consolidate all these var ...

Ways to initiate a new animation once another one has concluded

I am looking to initiate a jQuery animation once another one has completed. Initially, there is a slide down effect towards the second navigation bar: $(".navigation-bar1").click(function() { $('html,body').animate({ scrollTop: $(". ...

Enhance your Three.js experience: Effortlessly Panning Panoramas with Smooth E

I am currently working on a 6 cube panorama project and using this demo as a reference: The dragging functionality in this demo is controlled by mouse events. I am looking to implement easing so that the panorama cube follows the mouse smoothly. I underst ...

Customize the font color of the Bootstrap Nav-link as you scroll through the page

I am new to this platform and would really appreciate some help with a specific issue I am facing. Despite going through numerous posts, I have not been able to find a solution yet. Currently, I am utilizing the navbar component from Bootstrap (v5.0). My ...

How can I export various components in React JS using environmental variables?

Issue with React JS code: The goal is to have the src/app.jsx file export App by default when the REACT_APP_AUTH_SERVER variable in the .env file does not exist or has a value other than "aws-cognito". If the REACT_APP_AUTH_SERVER variable in .env exists ...

Creating a dropdown menu that includes miniature images: A step-by-step guide

Specifics I am interested in incorporating a small flag to the left of my dropdown menu. I need guidance on the recommended method for achieving this. My Attempt So Far <!-- Dropdown-Menu --> <div class="col-sm-6 drop-down "> S ...

What exactly is this issue? TypeError: Unable to retrieve property '0' from undefined

Encountering an issue while attempting to implement user authentication using mongodb and express. The error triggers every time the submit button is clicked on the website. This presents the first problem, followed by a second issue where the page continu ...

Avoid invoking a TypeScript class like a regular function - _classCallCheck prevention

I am currently developing a TypeScript library that needs to be compatible with all versions of JavaScript. I have noticed that when calling a class in TS without using new, it does not compile properly, which is expected. In ES6/Babel, a class automatica ...