ho provato a cambiare leggermente la funzione provando a forzare l'ancora specificando il nome, tuttavia mi punta sempre alla prima ancora sul documento html... non capisco!
<script>
$(function() {
$('a[href*=#formazione]').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[id=#formazione]');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
});
</script>