A simple example with a Button
to scroll up. It will only scroll if the javascript
is active, which is an event
listening to the scroll type
.
document.getElementById('btn').style.display='none'
window.addEventListener('scroll', (event) => {
console.log(scrollY)
document.getElementById('btn').style.display='inline'
})
_x000D_
a
long<br>
text<br>
comes<br>
long<br>
text<br>
again
<button id=btn class = 'btn btn-primary' onclick='window.scrollTo({top: 0, behavior: "smooth"});'>Scroll to Top</button>
_x000D_