Why is scrolling not working on mobile?

$("a[href*=#]").on("click", function(e){
var anchor = $(this);

scrollTop: $(anchor.attr('href')).offset().top-$('.header-menu-wrapper').height()-20
}, 1400);
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')) - 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