How can I do this through a javascript function, which activates the "Home" command, ie the page jumps to the top of it? Example: A button that is clicked at the bottom of the page redirects overflow to the top.
How can I do this through a javascript function, which activates the "Home" command, ie the page jumps to the top of it? Example: A button that is clicked at the bottom of the page redirects overflow to the top.
You can do this with jQuery
var body = $("html, body");
$('button').click(function(){
body.stop().animate({scrollTop:0}, 500, 'swing', function() {
});
})
p{
margin-top: 500px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p>OiM</p>
<button>Voltar</button>