Portfolio Project Issues - Viewport and Nav Errors

Hi,

I’m working on the personal Portfolio project, and I have 2 errors, I’m not sure how to fix. Any help would be appreciated. Thanks! :slight_smile:

Errors:
Content #7. The navbar should contain at least one link that I can click on to navigate to different sections of the page.

Uncaught TypeError: Cannot set property 'className' of null (https://s.codepen.io/anon/fullpage/OGqMzy:214)

Error: Uncaught TypeError: Cannot set property 'className' of null (https://s.codepen.io/anon/fullpage/OGqMzy:214)

    at a.onerror (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:154:205603)

var t=this,a=arguments;return new Promise(function(n,s){var o=e.apply(t,a);function i(e){r(o,n,s,i,l,"next",e)}function l(e){r(o,n,s,i,l,"throw",e)}i(void 0)})

Layout #3. The navbar should always be at the top of the viewport.

Uncaught TypeError: Cannot set property 'className' of null (https://s.codepen.io/anon/fullpage/OGqMzy:214)

Error: Uncaught TypeError: Cannot set property 'className' of null (https://s.codepen.io/anon/fullpage/OGqMzy:214)

    at a.onerror (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:154:205603)

var t=this,a=arguments;return new Promise(function(n,s){var o=e.apply(t,a);function i(e){r(o,n,s,i,l,"next",e)}function l(e){r(o,n,s,i,l,"throw",e)}i(void 0)})

My code so far

<!DOCTYPE html>
<html>
<title>W3.CSS Template</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body,h1,h2,h3,h4,h5,h6 {font-family: "Lato", sans-serif;}
body, html {
  height: 100%;
  color: #777;
  line-height: 1.8;
}

/* Create a Parallax Effect */
.bgimg-1, .bgimg-2, .bgimg-3 {
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

/* First image (Logo. Full height) */
.bgimg-1 {
  background-image: url('https://www.w3schools.com/w3images/parallax1.jpg');
  min-height: 100%;
}

/* Second image (Portfolio) */
.bgimg-2 {
  background-image: url("https://www.w3schools.com/w3images/parallax2.jpg");
  min-height: 400px;
}

/* Third image (Contact) */
.bgimg-3 {
  background-image: url("https://www.w3schools.com/w3images/parallax3.jpg");
  min-height: 400px;
}

.w3-wide {letter-spacing: 10px;}
.w3-hover-opacity {cursor: pointer;}

/* Turn off parallax scrolling for tablets and phones */
@media only screen and (max-device-width: 100%) {
  .bgimg-1, .bgimg-2, .bgimg-3 {
    background-attachment: scroll;
    min-height: 400px;
  }
}
	
.welcome-section {max-height: 100%; max-width: 100%
}
.navi {max-height: 100%; max-width: 100%}
	
</style>
<body>

<!-- Navbar (sit on top) -->
<div class="navi w3-top">
  <nav class="w3-bar" id="navbar">
    <a class="w3-bar-item w3-button w3-hover-black w3-hide-medium w3-hide-large w3-right" href="javascript:void(0);" onclick="toggleFunction()" title="Toggle Navigation Menu">
      <i class="fa fa-bars"></i>
    </a>
    <a href="#home" class="w3-bar-item w3-button">HOME</a>
    <a href="#welcome-section" class="w3-bar-item w3-button w3-hide-small"><i class="fa fa-user"></i> ABOUT</a>
    <a href="#projects" class="w3-bar-item w3-button w3-hide-small"><i class="fa fa-th"></i> PORTFOLIO</a>
    <a href="#contact" class="w3-bar-item w3-button w3-hide-small"><i class="fa fa-envelope"></i> CONTACT</a>
    <a href="#" class="w3-bar-item w3-button w3-hide-small w3-right w3-hover-red">
      <i class="fa fa-search"></i>
    </a>
  </div>

  <!-- Navbar on small screens -->
  <div id="navDemo" class="naiv w3-bar-block w3-white w3-hide w3-hide-large w3-hide-medium">
    <a href="#welcome-section" class="w3-bar-item w3-button" onclick="toggleFunction()">ABOUT</a>
    <a href="#portfolio" class="w3-bar-item w3-button" onclick="toggleFunction()">PORTFOLIO</a>
    <a href="#contact" class="w3-bar-item w3-button" onclick="toggleFunction()">CONTACT</a>
    <a href="#" class="w3-bar-item w3-button">SEARCH</a>
  </div>
</div>

<!-- First Parallax Image with Logo Text -->
<div class="bgimg-1 w3-display-container w3-opacity-min" id="home">
  <div class="w3-display-middle" style="white-space:nowrap;">
    <span class="w3-center w3-padding-large w3-black w3-xlarge w3-wide w3-animate-opacity">MY <span class="w3-hide-small">WEBSITE</span> LOGO</span>
  </div>
</div>

<!-- Container (About Section) -->
<div class="welcome-section w3-content w3-container w3-padding-64" id="welcome-section">
  <h1 class="w3-center">ABOUT ME</h1>
  <p class="w3-center"><em>Fishy Tod</em></p>
  <p>Tod enjoys roaming the streets of London, and breathing in the sweet aroma of the sea breeze and smells from the various shops. He's especially fond of places that sell meat pies. Todd is a barber by day and amature phlebotomist and butcher at night. While he is well known for this profession in this neighborhood, he recommends his friends vist other barbers if they need a late night shave or haircut. While Tod appriciates new technology, he's most fond of his straight razors, who crave red rubies. He also has a girl in his life...but we'll wrap up there to keep some mystery alive (parody profile of Sweeney Todd)</p>
	
  <p class="w3-large w3-center w3-padding-16">Im really good at:</p>
  <p class="w3-wide"><i class=""></i>Using a straight razor</p>
  <div class="w3-light-grey">
    <div class="w3-container w3-padding-small w3-dark-grey w3-center" style="width:89%">89%</div>
  </div>
  <p class="w3-wide"><i class=""></i>Haircuts</p>
  <div class="w3-light-grey">
    <div class="w3-container w3-padding-small w3-dark-grey w3-center" style="width:30%">30%</div>
  </div>
	<p class="w3-wide"><i class=""></i>Butcher</p>
  <div class="w3-light-grey">
    <div class="w3-container w3-padding-small w3-dark-grey w3-center" style="width:100%">100%</div>
  </div>
  <p class="w3-wide"><i class=""></i>Phlebotomy</p>
  <div class="w3-light-grey">
    <div class="w3-container w3-padding-small w3-dark-grey w3-center" style="width:59%">59%</div>
  </div>
	
</div>

<!-- Second Parallax Image with Portfolio Text -->
<div class="bgimg-2 w3-display-container w3-opacity-min">
  <div class="w3-display-middle">
    <span class="w3-xxlarge w3-text-white w3-wide">PORTFOLIO</span>
  </div>
</div>

<!-- Container (Portfolio Section) -->
<div class="w3-content w3-container w3-padding-64" id="projects">
  <h3 class="w3-center">Portfolio</h3>
  <p class="w3-center"><em>Image and link provided with permission of creator.</p>

  <!-- Responsive Grid. Four columns on tablets, laptops and desktops. Will stack on mobile devices/small screens (100% width) -->
  <div class=" w3-center">
    <div class="project project-tile">
     <center><a href="https://morethangraffiti.wordpress.com/"target="_blank"><img src="https://morethangraffiti.files.wordpress.com/2016/01/poster-trial-3-web.jpg" style="max-height: 25%; max-width: 25%" onclick="" class="w3-hover-opacity" alt="Poster"><a href="https://codepen.io/FreeCodeCamp/pen/KzXQgy" target="_blank" class="project project-tile"></center>
    </div>
  </div>
</div>

<!-- Modal for full size images on click-->
<div id="modal01" class="w3-modal w3-black" onclick="this.style.display='none'">
  <span class="w3-button w3-large w3-black w3-display-topright" title="Close Modal Image"><i class="fa fa-remove"></i></span>
  <div class="w3-modal-content w3-animate-zoom w3-center w3-transparent w3-padding-64">
    <img id="img01" class="w3-image">
    <p id="caption" class="w3-opacity w3-large"></p>
  </div>
</div>

<!-- Third Parallax Image with Portfolio Text -->
<div class="bgimg-3 w3-display-container w3-opacity-min">
  <div class="w3-display-middle">
     <span class="w3-xxlarge w3-text-white w3-wide">CONTACT</span>
  </div>
</div>

<!-- Container (Contact Section) -->
<div class="w3-content w3-container w3-padding-64" id="contact">
  <h3 class="w3-center">Contact Us</h3>
	<center>
  <div class="w3-row w3-section">
    <div class="w3-col m8 w3-panel">
      <div class="w3-large w3-margin-bottom">
      </div>
      </center><form action="/action_page.php" target="_blank">
        <div class="w3-row-padding" style="margin:0 -16px 8px -16px">
          <div class="w3-half">
            <input class="w3-input w3-border" type="text" placeholder="Name" required name="Name">
          </div>
          <div class="w3-half">
            <input class="w3-input w3-border" type="text" placeholder="Email" required name="Email">
          </div>
        </div>
        <input class="w3-input w3-border" type="text" placeholder="Message" required name="Message">
        <button class="w3-button w3-black w3-right w3-section" type="submit">
          <i class="fa fa-paper-plane"></i> SEND MESSAGE
        </button>
      </form></center>
    </div>
  </div>
</div>

<!-- Footer -->
<footer class="w3-center w3-black w3-padding-64 w3-opacity w3-hover-opacity-off">
  <a href="#home" class="w3-button w3-light-grey"><i class="fa fa-arrow-up w3-margin-right"></i>To the top</a>
  <div class="w3-xlarge w3-section">
    <i class="fa fa-facebook-official w3-hover-opacity"></i>
    <i class="fa fa-instagram w3-hover-opacity"></i>
    <i class="fa fa-snapchat w3-hover-opacity"></i>
    <i class="fa fa-pinterest-p w3-hover-opacity"></i>
    <i class="fa fa-twitter w3-hover-opacity"></i>
    <i class="fa fa-linkedin w3-hover-opacity"></i>
  </div>
  <p>Powered by <a href="https://www.w3schools.com/w3css/default.asp" title="W3.CSS" target="_blank" class="w3-hover-text-green">w3.css</a></p>
 <p>Visit <a id='profile-link' href="https://github.com/freecodecamp" target="_blank">GitHub</a></p>
</footer>
 
<script>
// Modal Image Gallery
function onClick(element) {
  document.getElementById("img01").src = element.src;
  document.getElementById("modal01").style.display = "block";
  var captionText = document.getElementById("caption");
  captionText.innerHTML = element.alt;
}

// Change style of navbar on scroll
window.onscroll = function() {myFunction()};
function myFunction() {
    var navbar = document.getElementById("myNavbar");
    if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
        navbar.className = "w3-bar" + " w3-card" + " w3-animate-top" + " w3-white";
    } else {
        navbar.className = navbar.className.replace(" w3-card w3-animate-top w3-white", "");
    }
}

// Used to toggle the menu on small screens when clicking on the menu button
function toggleFunction() {
    var x = document.getElementById("navDemo");
    if (x.className.indexOf("w3-show") == -1) {
        x.className += " w3-show";
    } else {
        x.className = x.className.replace(" w3-show", "");
    }
}
</script>

</body>
</html>

Project I’m working on

Browser: Chrome 74