I used the same code with the same problems. I switched to this code:
<script>
$('a').click(function (e) {
$('html, body').animate({
scrollTop: $($(this).attr('href')).offset().top
}, 1000);
});
</script>
and tagged my anchors like this <section id="#nameofsection"></section>.
at first I used anchor tags <a name="#anchorname></a>, but the scrolling did not work in safari until I used section id.