MarcOlmos's post in GSAP target not found of an element that doesn't appear when the page is loaded was marked as the answer
I've found the solution, thank you!!!
// wait until DOM is ready
document.addEventListener("DOMContentLoaded", function(event) {
console.log("DOM loaded");
// wait until images, links, fonts, stylesheets, and js is loaded
window.addEventListener("load", function(e) {
// custom GSAP code goes here
console.log("window loaded");
gsap.registerPlugin(ScrollTrigger);
document.getElementById("button").addEventListener("click", function(){
const notifyTL = new TimelineLite({paused: true})
notifyTL.to(".notifyjs-corner", {y: +70})
var prevScrollpos = window.pageYOffset;
window.onscroll = function() {
var currentScrollPos = window.pageYOffset;
console.log(currentScrollPos);
if (currentScrollPos > 218) {
notifyTL.reverse();
} else {
notifyTL.play();
}
}
});
}, false);
});