I have a div with overflow: scroll;
And I would like to put a button. When you press it, the content of the div
scrolls.
Something like:
You can try this:
function scrollDiv(){
document.getElementById("d").scrollTop += 100;
document.getElementById("d").scrollLeft += 100;
}
Rather than do
function scrollDiv(){
document.getElementById("d").scrollTop += 100;
document.getElementById("d").scrollLeft += 100;
}
would you not do
document.getElementById("d").scrollBy({
top: 100,
left: 100,
behaviour: 'smooth'
})