Closed minecraft00z closed 5 years ago
Hey @minecraft00z, yes, you would just need to scroll on the #page-wrap
element instead of window (as that is the element that scrolls):
const pageWrap = document.getElementById('page-wrap');
pageWrap.scrollTo({
top: 100,
left: 100,
behavior: 'smooth'
});
Hello. I've successfully implemented react burger menu on my site and it works. Now I want to add "Scrooll to top" button on my pages. I implemented this functionality earlier by scrolling window to the top:
But with the menu on the page it doesn't work. I think this is because we set 'overflow: auto' on the #page-wrap. When I disable 'overflow: auto' on the #page-wrap, scrolling starts to work, but when I open the menu my page suddenly scrolls to the top. Is it possible to somehow add scrolling to top functionality with 'overflow: auto' still being applied to the #page-wrap?