<style> | |
div { | |
background-color: yellow; | |
height: 500px; | |
width: 100px; | |
} | |
</style> | |
<div></div> | |
<button id="btn">Click</button> | |
<div></div> | |
<script> | |
document.getElementById("btn").scrollIntoView(); | |
document.getElementById("btn").scrollIntoView(); | |
</script> |