don't know how to scroll from one element to another when overflow is hidden
hey folks I have set the css property
overflow: hidden;
for the body and I need to smooth scroll from one element to another element and these are the element
so how do I smooth scroll from first div to second div4 Replies
you can use a bookmarklink (html/css)
or scrollIntoView (js)
I tried this
But got this error
are you sure you are selecting the secondContainer properly?
--edit: ohw i see. You are using
getElementsByClassName
. That collects an array of elements (even if it is only 1)
change that to
document.getElementsByClassName("secondContainer")[0]
to get the first of that array
or
document.querySelector(".secondContainer")
to only select the first appearance of a selectorOkay