JSFiddle - React, Tailwind, and code Playground

by EnzoMac

HTML

<div class="backtotop"> <a href="#">Back to Top</a></div>

CSS

body {
    height:1600px;
}
.backtotop
	{
		display: none;
		width:200px;
		height:20px;
		position:fixed;
		bottom:0;
		right:0;
		border:thin solid black;
		background:lightgray;
		color:black;
		z-index:1;
		text-align:center;
	}
	
	.backtotop a
	{
		color:black;
		font-family:calibri;
	}

JavaScript

$(document).scroll(function () {
    var y = $(this).scrollTop();
    if (y > 1) {
        $('.backtotop').fadeIn();
    } else {
        $('.backtotop').fadeOut();
    }

});