2
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 case the section
, at the top of the screen.
It sits in the middle of the screen. Is there any way to adjust it?
I need when you click on the link, it swipe the page and leave this section
at the top of the page, not in the middle.
Guy doesn’t use bind has been discontinued, use on in place and if you need off instead of unbind. Read more on the jQuery API: http://api.jquery.com/? s=bind
– LeAndrade