JSFiddle - React, Tailwind, and code Playground
HTML
<a href="#top" id="top-button">Top</a>
CSS
#top-button {
background-color: rgba(0, 0, 0, 0.5);
border-radius: 3px;
color: #00A2E8;
display: none;
padding: 5px;
position: fixed;
top: 35px;
right: 35px;
text-decoration: none;
}
JavaScript
var i = 0;
for ( ; i < 100; i++ )
{
document.body.innerHTML += "<p>Hello</p>"
}
$(window).bind('scroll', function () {
if (window.scrollY > 100) {
$('#top-button').fadeIn(300);
} else {
$('#top-button').fadeOut(300);
}
});