Quoi qu’il en soit d’utiliser scrollTop mais conserver le hashtag?

J’utilise le code suivant:

$('#toc a').on('click', function(e) { e.preventDefault(); $link = $(this).attr('href'); $('html, body').animate({ scrollTop: $($link).offset().top - 10 }, 1000 );  }); 

Mais j’aimerais qu’il conserve le hashtag à partir du lien dans l’adresse Web. Est-ce possible avec le code? Merci

 $('#toc a').on('click', function(e) { $link = $(this).attr('href'); $('html, body').animate({ scrollTop: $($link).offset().top - 10 }, 1000 ); });