Shortcut home button to upload the site?

Asked

Viewed 421 times

0

I have a website, and the customer asked that when I click on the home button of the website KEYBOARD rise in full. How I do?

  • 1

    Duplicate? https://answall.com/q/161986/4808

1 answer

0

Using Jquery

//scroll normal
$('html,body').scrollTop(0);

//scroll suave
$('html, body').animate({scrollTop:0}, 'slow'); //slow, medium, fast

Using Javascript

var scrollTop = function() {
    window.scrollTo(0, 0);
};

Suggestion of Francis Vagner of the Light

HTML pointed the href link to the section of the page at the top:

<span id='topo'></span>

<p>
  bla bla <br> bla bla <br> bla bla <br> 
  bla bla <br> bla bla <br> bla bla <br>
  bla bla <br> bla bla <br> bla bla <br>
  bla bla <br> bla bla <br> bla bla <br>
  bla bla <br> bla bla <br> bla bla <br>
  bla bla <br> bla bla <br> bla bla <br>
  bla bla <br> bla bla <br> bla bla <br>
  bla bla <br> bla bla <br> bla bla <br>
  bla bla <br> bla bla <br> bla bla <br>
  bla bla <br> bla bla <br> bla bla <br>
  bla bla <br> bla bla <br> bla bla <br>
  bla bla <br> bla bla <br> bla bla <br>
  bla bla <br> bla bla <br> bla bla <br>
</p>

<a href='#topo'>Voltar ao topo</a>
  • You can also put a DIV at the top of the site with an id.. Then just put on the home button, in href the name of this id instead of a URL.. If you want to post your code I can show you better.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.