jeudi 17 septembre 2020

How do I know when to make my scroll down button visible?

Recently I have been busy making a chatting app. What I want is: When a new message comes, you have to scroll down to see it, but I want a button that appears when I have not scrolled to the bottom of the page. here is my current code:

if (messages.scrollTop =! messages.scrollHeight) {
        var dwn = document.getElementById("down");
        dwn.style.height="30px";
        dwn.style.width="30px";
    }

    else{
        var dwn = document.getElementById("down");
        dwn.style.height="0px";
        dwn.style.width="0px";
    }

By the may messages is the container from which I want the scroll down button to appear if it not scroll to the dead bottom.




Aucun commentaire:

Enregistrer un commentaire