I am reposting this project as I realized I needed some other aspects included in it.
I have a website. I want a div to appear after a user scrolls down the page a certain number of pixels, and again disappear if he scrolls back up again. I already have most of the code ready, but the problem is the closing of the popup. I have an X that people can click on which hides the div, but as soon as you start scrolling up or down the div reappears.
Also I need to implement cookie support for it, so that if someone closes it once, it should not reappear on other pages for 1 day.
So the main work is to make the close button work properly so that the popup stays hidden and doesn't keep reappearing, along with cookie support.
I am attaching the code I have made so far which you will modify.
If the user clicks the close button then it should set a cookie and not reappear for 1 day.
If a user doesnt click the close button but just scrolls up, it should fade out, but not set the cookie, so if they scroll down again it will re-appear.