How can I scroll to a specific location on the page using jquery?

1

Is it possible to scroll to a specific location on the page using jQuery?

The location I want to scroll must have:

<a name="#123">here</a>

Or can you simply pass a specific DOM ID?

    
asked by anonymous 26.09.2018 / 16:41

1 answer

1

Try this:

$("#botao").on('click',function() {
    $('html, body').animate({
        'scrollTop' : $("#div_para_scrollar").position().top
    });
});
    
26.09.2018 / 16:44