Why is scrolling not working on mobile?

$(document).ready(function(){
$("a[href*=#]").on("click", function(e){
var anchor = $(this);
$('html').stop().animate({

scrollTop: $(anchor.attr('href')).offset().top-$('.header-menu-wrapper').height()-20
}, 1400);
e.preventDefault();
return false;

});
});

here is the code scrolling
da.bestwebsite2019.ru website
March 12th 20 at 08:07
2 answers
March 12th 20 at 08:09
"$(anchor.attr('href')).offset().top"
$(anchor.attr('href')) - judging by the links on the website, it turns out that this is equal to "#", that's the question which element is scrolling on top

the main problem in the console: "Uncaught TypeError: Cannot read property 'top' of undefined", which means that not just the total top padding for scrolling
March 12th 20 at 08:11
Thanks, I can get more, how to be?

Find more questions by tags WordPressJavaScript