I’m trying to find a way to reset navigation bar back to its original position before the transition. Any ideas on how to do it? I tried adding and removing classes but it doesn’t really work accept for the first if statement.
link:codepen.io/anon/pen/yEENgp
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.classList.add("back");
}
})
}