You need to have in the menu some target indication for scroll.
Could be the id
of the widget stored in a property data
, a href/anchor or other. If using an anchor (<a>
) may need to use the .preventDefault()
to prevent the link from being followed (in some cases you even want the link to be in the url, so you should not use).
Then you have to intercept the click you can use jQuery . anymate() to scroll, going to get the position of this element as a target.
Example of HTML
<div class="menu">
<div data-destino="parte1">Parte 1</div>
<div data-destino="parte2">Parte 2</div>
</div>
<div id="parte1"></div>
<div id="parte2"></div>
Example of jQuery
$('.menu div').on('click', function () {
var destino = '#' + $(this).data('destino');
var posicaoDestino = $(destino).position().top;
$('html, body').stop().animate({
scrollTop: posicaoDestino
}, 2000);
});
Example: http://jsfiddle.net/zc966/
In the future please put code in the question, so we can answer in detail to the problem you have.
– Sergio
Robson, the answers were correct to the problem you had?
– Sergio