I have two images, each one of them represents a button to scroll up or down on the site. Here I attach the two images:
I have added the images with the following code:
<img src="https://certifiedgoldexchange.com/wp-content/uploads/2021/05/btn-scroll-down.png" alt="scroll" id="btn-scroll-down">
<img src="https://certifiedgoldexchange.com/wp-content/uploads/2021/05/btn-scroll-up.png" alt="scroll" id="btn-scroll-up">
my javascript code for scrolling is the following:
var scrollup = document.getElementById("btn-scroll-up");
var scrolldown = document.getElementById("btn-scroll-down");
scrollup.addEventListener("mousedown", function(){ window.scrollBy(0, -100);})
scrolldown.addEventListener("mousedown", function(){ window.scrollBy(0, 100);})
Everything works fine, but I want it to also work by holding down the click on them, how could I solve it? I appreciate your help.