Just wanted to mention that I'm pretty new to this, so if I use the wrong terms, I apologize in advance.
I am trying to replicate Morning Brew's sticky footer opt-in form (check it out here). However, the code I have now only tracks pixels. Is there a way for me to modify it so that it detects div tags instead?
<script>
var prevScrollpos = window.pageYOffset;
window.onscroll = function() {
var currentScrollPos = window.pageYOffset;
if (prevScrollpos < 4200 && prevScrollpos > 200) {
document.getElementsByClassName("_form")[0].style.display = "block";
} else {
document.getElementsByClassName("_form")[0].style.display = "none";
}
prevScrollpos = currentScrollPos;
}
</script>