Clicking on a button, how to slide the screen down

0

I have a pricey area, and I have a button next to "have more details", I want that when clicking this button, the screen scroll down the page that is where I have the "contact" section. I wanted to know how to do this "slip"

    
asked by anonymous 08.10.2016 / 00:52

3 answers

0

Use anchors:

poe this on the button:

<a href="#anchor">botão</a>

And where do you want to go, you poe:

<a name="anchor"></a>

    
08.10.2016 / 01:00
0

If you want the screen to slide with animation, you can use jquery animate .

$("#button").click(function() {
  $('html, body').animate({
    scrollTop: $("#anchor").offset().top
  }, 2000);
});
    
13.10.2016 / 23:11
0

Do not use the name attribute, this is deprecated in the latest version of HTML, and J. Guilherme's answer may not work in newer browsers. Use id :

<div id='meuelemento'> <!-- ... --> </div>

And no <a> :

<a href='#meuelemento'> <!-- ... --> </a>
    
19.10.2017 / 12:42