Reputation: 1474
I'm using the following code:
$('#toc a').on('click', function(e) {
e.preventDefault();
$link = $(this).attr('href');
$('html, body').animate({
scrollTop: $($link).offset().top - 10
}, 1000 );
});
But would like it to keep the hashtag from the link in the web address. Is this possible with the code? Thanks
Upvotes: 0
Views: 197
Reputation: 318212
$('#toc a').on('click', function(e) {
$link = $(this).attr('href');
$('html, body').animate({
scrollTop: $($link).offset().top - 10
}, 1000 );
});
Upvotes: 1