navBar not fading out <p>I'm writing a script in order for the navBar to go in on certain place and disappear on that same place. I managed to make it go in, but it won't leave. I can't find my mistake. Please help me. Here is my code: </p> <pre><code>var dummie = document.getElementById("dummie"); var navBar = document.getElementById("navBar"); var test = function(){ dummie.textContent = window.pageYOffset; if(window.pageYOffset &gt; 351){ navBar.style.visibility = "visible"; } else { if(window.pageYOffset &lt; 351){ navBar.visibility = "hidden"; } } } window.setInterval(test, 1); </code></pre>