'How to hide an element when scrolling down using JavaScript?

I have this code that shows social icons after scrolling down, I want to make it disappear when I reach a specific class and reappear when I scroll up

<script>
var element=document.querySelector(".social-icons");
window.onscroll=function(){
    var e=window.pageYOffset,
    t=document.querySelector(".social-icons");
    window.innerWidth;e>200?t.classList.add("active"):t.classList.remove("active");
};
</script>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source