Hi Campers,
I am using the following code to make an element scroll to another element when clicked:
document.getElementById("top-button").addEventListener('click', function(){
document.getElementById('landing-section').scrollIntoView({
block: 'start',
behavior: 'smooth'
});
in Firefox it scrolls so the top of the page is at the top of the target element (this is what I want), but in chrome it goes somewhere in the middle. I added the “block: ‘start’” option to scrollIntoView’s options parameter but it still doesn’t go to the top. Any ideas why this might be?
here is the live site:
https://mike-silverman.com/
The “About” and “Projects” buttons at the top are the buttons I am having troubles with.
Here is the github repo: