i have dropdown that opens a menu past the body/html height as you can see here:

r/webdev - how to auto scroll down to element that goes past body/html ?

i am trying to make it auto scroll to the bottom of the page when the dropdown opens. javascript:

const dropdown_button = document.getElementById("dropdown_button");
dropdown_button.addEventListener("click", (event) => {
    document.body.scrollTop = document.body.scrollHeight;
});

this is not working.

it’s supposed to look like this:

r/webdev - how to auto scroll down to element that goes past body/html ?

i have spent like 2 hours searching to no avail.
thanks appreciate help.



Source link

Write A Comment