Scroll To Top Botton By Css And Javascript

<style type="text/css">
.ktop{
position: fixed;
width: 35px;
height: 35px;
background-color: #d50;
bottom: 20px;
right: 10px;
color: white;
text-align: center;
font-size:32px;
border-radius: 4px;
}
</style>


<a class="ktop"  id="scroll-btn" href="#"><i class="fa fa-angle-up" aria-hidden="true"></i></a>


<script>

document.getElementById("scroll-btn").style.display = "none";
window.onscroll = function()
{
if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50)
{
document.getElementById("scroll-btn").style.display = "block";
}
else
{
document.getElementById("scroll-btn").style.display = "none";
}
};
</script>


Post a Comment

0 Comments