My background overlay is appearing when I resize my browser window

When I click the hamburger menu icon, the menu appears and disappears as it should. But, when I resize the browser window at various points the menu overlay appears, and then disappears. Can some please help me fix this issue? I posted my HTML, CSS, and Javascript code below. Thank you for any help.

HTML CODE:
<!DOCTYPE html>
<html lang="en">
<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">
    <title>Hamburger Navigation</title>
    <link rel="stylesheet" href="css/style.css">
</head>
<body>
  <div class="container">
    <nav class="navbar">
      <div class="hamburger-menu">
        <div class="line line-1"></div>
        <div class="line line-2"></div>
        <div class="line line-3"></div>
      </div>
      <ul class="nav-list">
        <li class="nav-item"><a href="#" class="nav-link">Home</a></li>
        <li class="nav-item"><a href="#" class="nav-link">About Us</a></li>
        <li class="nav-item"><a href="#" class="nav-link">News</a></li>
        <li class="nav-item"><a href="#" class="nav-link">Gallery</a></li>
        <li class="nav-item"><a href="#" class="nav-link">Events</a></li>
        <li class="nav-item"><a href="#" class="nav-link">Pricing</a></li>
        <li class="nav-item"><a href="#" class="nav-link">Contact</a></li>
      </ul>
    </nav>
  </div>
  
  <script src="js/main.js"></script>
</body>
</html>

CSS CODE
@import url('https://fonts.googleapis.com/css?family=Dosis&display=swap');

* {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Dosis", sans-serif;
}

.container {
  width: 100%;
  height: 100vh;
  background: linear-gradient(rgba(0,0,0,.4),
    rgba(148, 48, 48, .2), rgba(167, 67, 67,.4)),
    url('../img/bridge.jpg') center no-repeat;
    background-size: cover;
}

/* Styling the navigation */

.navbar {
  width: 100vw; /* Change back to 300px if this doesn't work right */
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  position: fixed;
  top: 0;
  right: -100vw; /* This will be set to -300px if 100vw above doesn't work */
  display: flex;
  justify-content: center;
  align-items: center;
  /* border-radius: 20%; 0 0 60%; */
  transition: right .8s ease;
}

.change {
  right: 0;
}

/* Hamburger Menu */

.hamburger-menu {
  width: 35px;
  height: 30px;
  position: fixed;
  top: 50px;
  right: 50px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}

.line {
  width: 100%;
  height: 3px;
  background-color: #fff;
  transition: all 0.8s;
}

/* Creating a X on the hamburger menu */



/* Styling the nav list */

.change .line-1 {
  transform: rotateZ(-405deg) translate(-8px, 6px);
}

.change .line-2 {
  opacity: 0;
}

.change .line-3 {
  transform: rotateZ(405deg) translate(-8px, -6px);
}

.nav-list {
  /* text-align: right; Add back if 100vw doesn't work */
}

.nav-item {
  list-style: none;
  margin: 25px;
}

.nav-link {
  text-decoration: none;
  font-size: 22px;
  color: #eee;
  font-weight: 300;
  letter-spacing: 1px;
  text-transform: uppercase;
  position: relative;
  padding: 3px 0;
}

/* Adding line animation on hover */

.nav-link::before,
.nav-link::after {
  content: '';
  width: 100%;
  height: 2px;
  background-color: #fff;
  position: absolute;
  left: 0;
  transform: scaleX(0);
  transition: transform .5s;
}

.nav-link::after {
  bottom: 0;
  transform-origin: right;
}

.nav-link::before {
  top: 0;
  transform-origin: left;
}

.nav-link:hover::before,
.nav-link:hover::after {
  transform: scaleX(1);
}

JAVASCRIPT CODE

const menuIcon = document.querySelector('.hamburger-menu');

const navbar = document.querySelector('.navbar');

menuIcon.addEventListener('click', () => {
  navbar.classList.toggle("change");
});

I think I figured out my problem already. In the .navbar class, I changed the right: -100vw to -200; and the transition to transition: right .8s ease-in-out. and that took care of the issue. Sorry, I thought it was a JS problem, it turns out, it’s a css problem.