Toggle another transition using Javascript

Toggle another transition using Javascript
0.0 0

#1

I’m trying to trigger another transition on the second navigation bar after its first transition scrolling down 100 pixel. The next transition I want should toggle after the user scrolls back less than 100 pixel but I have not been able to find another way to trigger another transition to place the nav bar back into its original position where its not visible. The rest of the code is in the link. Any ideas how I can approach this? Should I add another class?

window.onload = function (){
var nav = document.getElementById(‘nav’)

window.addEventListener(‘scroll’, function () {
if (window.pageYOffset >= 100) {
//nav.style.display = ‘block’;

     nav.classList.add("transition");
     nav.classList.toggle("transition");
}

  if (window.pageYOffset <= 100)  {
  nav.classList.remove("transition");

//add another class?
//nav.style.display = ‘none’

}

})

//call function to move to the next image
var click = document.getElementById(‘gallery’);
click.addEventListener(“click”, push);

}