I created a script as follows:
<script>
$(function() {
$('#mostrar_planos').bind('click',function(event){
var $anchor = $(this);
$('html, body').stop().animate({scrollTop: $($anchor.attr('href')).offset().top}, 500,'swing');
});
});
</script>
<a href="#mostrar_planos" id="mostrar_planos">Confira os planos</a>
<section id="mostrar_planos"> conteudo </section>
It works normally, but does not leave the ID that was called, in this case section
, at the top of the screen.
It sits in the middle of the screen. Is there any way to tweak this?
I need when I click the link, it slides the page and leaves that section
at the top of the page, not in the middle.