Mastering Development

‘classList’ property returning null when element is present?

I’m fairly new to JS so I’m sorry if this has been answered.

I’ve siphoned through most answers and they didn’t specifically fall in line with mine.

I’m not understanding why the element cant is called upon when it’s there.

I don’t think it seems to be anything with the CSS but I’m not completely sure.

const navSlide = () => {
  const burger = document.querySelector('.burger');
  const nav = document.querySelector('nav-links');

  burger.addEventListener('click', () => {




  display: flex;
  align-items: center;
  min-height: 8vh;
  background-color: var(--mainBg);

.nav-links li{
  list-style: none;

  display: flex;
  justify-content: space-evenly;
  width: 20%;
  font-size: 20px;
 .nav-links a{
  letter-spacing: 2px;

  display: none;
  cursor: pointer;

.burger div{
  width: 25px;
  height: 4px;
  background-color: var(--mainText);
  padding: 0;


  background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),url("img/D1.jpg");
  height: 600px;
  background-repeat: no-repeat;
  background-size: cover;
  position: relative;


  text-align: center;
  position: absolute;
  top: 50%;
  left: 28%;
  color: var(--mainBanner);
  font-size: 20px;

/* Media Queries*/

  @media screen and (max-width:1024px){
    width: 60%;

@media screen and (max-width:728px){
  overflow-x: hidden;
    position: fixed;
    right: 0px;
    height: 92vh;
    top: 8vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 50%;
    transform: translateX(100%);
    transition: transform 0.5s ease-in;
  .nav-links li{
    opacity: 0;
    display: block;
    margin-left: 28em;

    transform: translateX(0%);


@keyframes navLinkFade{
    opacity: 0;
    transform: translateX(50px);

    opacity: 1;
    transform: translateX(0px);


@media screen and(max-width:566px){
        <ul class="nav-links"> 
          <li><a href="index.html ">Home</a></li>
              <li><a href="about.html ">About</a></li>
              <li><a href="services.html ">Services</a></li>
              <li><a href="contact">Contact</a></li>

          <div class="burger">
              <div class="line1"></div>
              <div class="line2"></div>
              <div class="line3"></div>


  <div class="showacase-hero">
      <div class="hero-container">
      <h1>Yade's Pet</h1>
      <span class="banner"><p>Petcare Specialist/Dog Walker</p></span>
      <form action="">
           <button class="btn" type="submit">Let's Take a Stroll</button>
  <script type="text/javascript" src="app2.js"></script>

Leave a Reply

Your email address will not be published. Required fields are marked *