JSFiddle - React, Tailwind, and code Playground

by Arindam Nayak

HTML

<div class="txt">
    sdfsd
    sfs
    df
    sd
    fs
    df
    sd
    fsd
    f
    ds
     sdfsd
    sfs
    df
    sd
    fs
    df
    sd
    fsd
     f
    ds
     sdfsd
    sfs
    df
    sd
    fs
    df
    sd
    fsd
     f
    ds
     sdfsd
    sfs
    df
    sd
    fs
    df
    sd
    fsd
    f
    ds
</div>
<div id="scrl">
    Up
    <div>

CSS

.txt
{
    height:10px;
    width:10px;
    max-height:10px;
  
}
#scrl

{
    position: fixed;
right: 10px;
top: 40%;
z-index: 100;
    float:right;
    cursor:pointer;
}
}

JavaScript

$("#scrl").click(function() {
    $('html, body').animate({scrollTop : 0},800);
} );