Scrooll Up Button
<html>
<head>
<meta charset="UTF-8">
<title>Index</title>
</head>
<body>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 20px;
}
position: fixed;
padding: 15px;
right: 10px;
bottom: 10px;
background-color: red;
font-size: 30px;
border: solid;
border-radius: 50px;
}
</style>
<strong>Raj</strong> Munna</div>
var mybutton = document.getElementById("myBtn");
window.onscroll = function() {scrollFunction()};
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
</script>
</body>
</html>
No comments