1
I have a one-page site that will follow the following pattern:
<section id="home"></section>
<section id="empresa"></section>
<section id="mapa"></section>
<section id="contato"></section>
To make the transition of screens, I usually use the scrollTop
, but I have to inform the position of each Section in px
. And that’s not what I want.
Is there any way I can scroll straight to id desired, or something like that?
What I currently use:
$('.home').click(function () {
$('html, body').stop().animate({
scrollTop: '0'
}, 700);
setHistory('MEUSITE- Home', site + '/home');
});
$('.empresa').click(function () {
$('html, body').stop().animate({
scrollTop: '855px'
}, 700);
setHistory('MEUSITE- Empresa', site + '/empresa');
});